An optimal dividends problem with a terminal value for spectrally negative Levy processes with a completely monotone jump density