This paper studies a general Lévy process model of the bail-out optimal dividend problem with an exponential time horizon, and further extends it to the regime-switching model. We first show the optimality of a double barrier strategy in the single-regime setting with a concave terminal payoff function. This is then applied to show the optimality of a Markov-modulated double barrier strategy in the regime-switching model via contraction mapping arguments. We solve these for a general Lévy model with both positive and negative jumps, greatly generalizing the existing results on spectrally one-sided models.