Sounds like you couldn't help yourself (like addiction) but that you saw what you were doing. That is a good sign. You seem very aware. I've been there where I've had to ask myself "why am I really doing this?" each time I wanted to drop a line to someone I broke up with. Each piece of communication keeps the door open a little. If I wanted the door closed then what was I doing trying to keep it open? It's hard because my ego wanted him to keep thinking of me and wanting me. In order to let go of the relationship I had to bite the bullet and let go in every way. Good luck. It'll probably be uncomfortable for a while but that's ok!