A standing pilot is a small safety system, and a closet is a place where it can fail for reasons that have nothing to do with the gas valve. The flame has to be strong enough to prove itself, and the closet has to supply air and draft.
The safety chain
The pilot heats a thermocouple, which produces a small voltage. The gas control valve holds the pilot port open while that voltage is present. When the flame weakens or the sensor cools, the valve closes.
The checks run in order: the pilot flame's size and position, whether it covers the thermocouple, the connection and output, the gas pressure, and the vent. Only then is the valve treated as the fault.
Air and draft
A closet that draws combustion air from the room needs a path for it. Louvres blocked by stored items, a sealed door, or a resident's alteration can starve the flame. The pilot suffers first because it is small.
A shared flue adds another variable. If the building has changed a rooftop appliance or worked on the termination, the closet unit's draft may have changed with it. The fault history — especially when it started — is part of the diagnosis.
Electronic ignition
Newer units spark and prove flame electronically. Their failures show as repeated attempts, a lockout or a code, and the manufacturer's list is the reference. The closet conditions still matter: air, vent and gas supply are checked the same way.
The visit
The technician confirms the pilot, the sensor, the gas valve's hold, the vent and the air path, then tests the unit through a cycle. Where the closet's air path is the problem, the fix may be ventilation or a sealed-combustion unit rather than a part.
Safety
A gas smell is a building emergency. Leave the unit, avoid switches and flames, call 911 or the utility from outside, and notify management. Soot or a yellow flame is a reason to keep the heater off until it is checked.