Old bathroom gas heater - how to cap it off?
While in theory gas fitting isn't very different from other kinds of plumbing, the consequences getting it wrong are obviously much worse. If you care about safety enough to want to disable this heater, I strongly suggest that you also care enough to want a pro to deal with disconnection and capping of the pipe.

If there's a valve in the line as well as in the appliance, closing that is an alternative. More easily reversible, and possible to DIY ... though me being paranoid, I'd be inclined to carefully check for signs of leakage after mucking with that. (Soapy water test at least, preferably a gas leakage alarm)

Quick thought: if you ever turn that heater back on, might be worth having a carbon monoxide check done, and tuning it to minimize that.