When a bike is running at a good rpm and dies like somebody threw a switch, it means something is badly wrong. As an old mechanic once told me, an internal combustion engine runs on air, fuel, and fire, plus compression. I've never seen a bike stop running because of air supply, so it's not that. And they don't stop suddenly from a fuel failure; more likely, it would have done a panic-rev as the fuel supply dried up. So it's not fuel. That leaves spark and compression, and either one will cause a sudden failure. Is the bike excessively easy to kick over? If so, you've lost compression and will have to rebuild the top end or the valves. If compression seems good, pull the plug out and attach the lead wire. Ground the plug on the engine head and kick it over in the dark. You should see a hot spark. If no spark, you need to test the stator, the pulse pickup, and the coil. One of those is probably bad; that happens to KTMs sometimes. Hint: check your spark plug lead wire first, though, to make sure it's not broken. That's a cheap fix.