that way even if it is forgotten, it still shuts off after some prescribed period. Intermatic makes mechanical spring wound timer switches that work this way... in various time increments.
When using a gas appliance one would simply "wind up" the timer... be it for 15 minutes or a couple of hours... the timer controls the solenoid.
Go to Amazon and search for "intermatic spring wound timer."
I have no connection to intermatic... I just happen to have done this research for a similar timing need.