Was this one time event or it happens regularly?
I am always turning off the engine with mixture lean. Apparently if you just turn off the magnets the gasses in the cylinder can self ignite (it happened before).
Otherwise there might be a problem with electric circle switch witch is stuck in off position so the magnetos are not grounded.
Hope this might help 😉