Water heater thermocouple monitors the pilot light to ensure it's lit and closes the gas valve if it detects a loss of flame