Gas heater won't turn on

I have the same problem with our gas heater (Pyrox 625 - over 20 years old) not staying on even after holding down the red ignition button for over 20 minutes (!) It got gradually worse over time till now it never stays on.
This might be a silly question but is it necessary to turn off the gas to the heater before replacing the thermocouple?
thanks Simon

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website for homeowners and building and maintenance pros. It is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.