Your problem could be 1. a sticky idle control in your pump, or 2. a bad shutoff solinoid 3. a bad wire or fuse 4. a bad key switch. Covering the air intake will shut it off for sure but, since that is not how it was designed to be shut off I would want to know why.
The first I would do since your machine has an electric shut off is check the fuse. After that.
Do you know where your injector pump is? If so on the govneor is where the fuel shut off solinoid is, is there a manual shut off there also? If so that will save you from dashing to the air filter intake to stop the engene. Since the key shut off did not work you may have sticking parts inside the injector pump, try this.
On top of the govenor usually is a vent, under the vent cap should be a nut (about 15mm give or take) that is your lube oil fill hole. On the far end of the pump on the bottom is the lube oil drain. Usually about 1/2 way up the pump above the drain is a bolt with a tiny downward tube, the tube may or may not be covered with plastic if it is covered remover the cover, that is the over fill (if you over fill the pump the excess lube oil drains from there).
Drain the oil from the pump (save it and measure to know how much to replace). Pour that measured amount of diesel in the lube oil fill hole and run the tractor for a minite and try to shut it off with the key, if it shuts off good if not cover the air intake to shut off the engine.
Now drain the deisel from the pump and replace it with the same oil that you use in your engine. Whenever I change my engine oil the injector pump also gets an oil change.
If the key switch did turn off the engine :thumbsup: If not call your local deisel guru explain what you have done and he should know where your problem is.