How to safely use and store a generator