POP and Spark when killing the engine



So I was out for a ride last night, at the tail end of my break in period, and as I'm coming in I hit the kill switch and the motor sounds like its killing, but then suddenly doesn't go all the way out.... so I hit it and hold it down this time, and it goes out... but not before a huge POP and spark below me. It looked like it was in the exhaust, but I'm not positive as it happened so quick. Any ideas how/why this happened?

Kill switch was probably not grounding out completely...have to make sure you have a good ground to kill the engine quickly...The pop and "spark" you saw was probably a backfire
(because of the slow engine kill)....Spark was the flash of gases caused by the backfire...

Prolly a intermittent ground at the kill switch sent a surge into the secondary causing a spark late in the power stroke...hence a loud bang. A loud bang could break a bit of carbon loose and set it aglow...hence a lightening zap in the exhaust along with the bang.
My guess anyhoo given what you offered.
thanks guys. ill check out the wire ground.

My flux capacitor has a poodle in it.