The thermocouple on all that I have seen keeps the gas flow going after it is lit. It is lit by a spark when the button on the refrigerator is pushed in gas mode.
The burner has always been the culprit when ours fails to stay started on gas. The burner needs to be cleaned regularly and replaced eventually. Ours burner has narrow slots that the gas comes through and they get blocked by rust/dirt over time and the flow won't warm the thermocouple enough to hold the gas valve open.
If there is not even enough gas flowing to light the burner when the button is pushed, that is a different problem entirely that ours has never exhibited.