What model year is your Kioti? I think in 2008 or 2009 and later, it was a power on solenoid for the injection pump. Mine is a CK30hst 2004 which is opposite. A diesel engine, once started doesn't need any electrical power to run. So if your thinking electrical, then something is activating the injection pump fuel shut off solenoid. The key switch can start to go bad, which has happened to many, and give this type of symptom. I had to change my switch after similar symptoms like yours. You can try cleaning it with some WD-40, PB Blaster, or your preferred cleaner which does help. Just spray it in the key hole and work it back and forth. Also if electrical, there are several wire plugs under the right floor board that can get corroded connections and cause problems. If it was starving for fuel somehow, the engine should slow down and then stop. Not just immediately shut down so I think your on the right track which should take you to the engine stop solenoid being activated. My CK only has one safety switch on the clutch and only works when you crank the engine over. If yours is newer, it may have more safety switches, and worth checking as mentioned. Just read the prior post after typing. When it stops, is it a sudden shut down, as when you turn it off, or does the rpm slow down and then stop? If the later,, then a possible fuel problem.