What am I?

You do not want me when you don’t have me, but when you have me you don’t want to lose me. What am I?