You may also want to check the overtemp sensor which can cause your gas valve to switch off if it detects an overheat condition in the heater. The sensor may have gone bad and tripped early without a true overheat. That may explain why the pilot stays on until the burners start heating, then everything goes out at the same time.
The overtemp is located in a cavity in the upper half of the heater. To locate it, remove the heater cover panel (usually one or two screws at the sides or the top, then two more screws on brackets near the gas valve area), then trace one of the wires that go into the valve box. There should be wires for your generator, wires for the thermostat, and the remaining set is for the overtemp sensor. It should be very easy to remove and replace it.