I don't think you are asking the right question based on information you give us.
Was the game getting tough? Did you suckout for the double-up? Did a player come on the table you didn't think you could beat? Did you double-up in great EV situation?
What was your reason for leaving the table? Your reasoning for leaving will dictate if it was the right strategy. For example, if I was constantly winning pots with AJ+ vs 83o, I would stay as my opponents would provide way more profit than just a double up. On the other hand, if the game was way too loose and big hands were getting constantly cracked because six players were seeing flops in raised pots, I'd leave in order to protect the stack as even AA isn't a favorite against 5 hands. As this shows, your reasoning for leaving will dictate if it was the correct strategy.
I would recommend Tommy Angelo's Elements of Poker for you to review as well, as he discusses the skill of quitting.