If it was the thermostats, either the high limit or the operating it wouldn't heat up at all.
What happens is the coils heat up because one of them is shorted.
After they heat up the coil opens and valve will not pass gas,no fire.
After a few hours they cool off and will work again for a bit...