A similar, common and safer mechanism is to just move water. Instead of spinning up a flywheel, water is pumped to an upper reservoir. When the power is needed, it's drained through a generator and the water can be reused when there is excess energy again.