You obviously have a switch problem
Believe it or not I have seen a similar case where it was ants in the switch
The problem is finding a good ground on mowers where everything is plastic .
If you mower has a carb solenoid and the solenoid works then you can ( for the purpose of testing only ) remove the kill wires , check that the solenoid shuts down the engine then mow like that for a few weeks to see if the problem goes away
Just be very careful because without the kill wires in place you can get off the mower with the blades running and new feet are a lot more expensive than new magnetos .