This is one of the most common beginner problems. What helped me is having a plan. When you realize you're dreaming, don't dwell on it. Interact with your dream. Immediately do something. This has become second nature to me now. Rubbing your hands is a plan. I recommend running around. It takes awhile to have consistency in your lucid dreams. Even people who have had them for a long time can fall into problems. you're doing the reality checks in your dream so you're almost there. I'm sure you'll have another long one in no time at all.