OH thinks of himself as an asshole

We were in bed, talking before we went to sleep, we still had the light on. I told him to wait a moment cause I needed to go pee (perks of being pregnant). When I came back from the bathroom he had turned the light off and hidden. I left the light off as I climbed into bed expecting him to be there but he wasn't. I'm not ashamed to admit that I'm somewhat scared of the dark, so this freaked me out and I said into the room "This isn't funny". He came out of his hiding place, got on the bed and apologised. I explained why I freaked out and his response was "sorry I'm an asshole, I forgot". Then he wouldn't speak to me or give me (or bump) a goodnight kiss. I've tried to get him to stop putting himself down, but I don't know what to do any more. He's not an asshole, he just sometimes takes jokes too far, which nearly everyone does at some point or another. I know he didn't mean to scare me, so how can I make him understand this? What can I say to him to make him happier with himself and stop putting himself down?