Sure sounds to me like you have a problem with a faulty thermostat on this heater which for some reason is sticking and not allowing the valve that allows the gas to flow to open and close properly. I would suggest you look at the thermostat and it’s likely replacement to resolve your problem.
If the heater has a Robertshaw RT control valve then it is very likely that the poppet valve seat is sticking and you should get a suitably qualified serviceperson to attend to it freeing up ( which usually involved cleaning the valve seat and the guide ).
Selgas Services Ltd
Craftsman Gasfitters, Plumbers, Electrical Service Technicians