I have the exact same compulsion with locking my door. If I leave my apartment and I don't do my little ritual then I'll either be worried all day, or some times I'll drive back to my apartment and "properly" close the door.
If this starts bugging me again I'm going to start taking pictures of the locked doors for myself. :)
When I get irrational urges, I make the urges battle my insecurities and get out of the way. Insecurities usually win.