Welcome to the Forum. So...
Does it loose power and slow down and stall like there was a fuel starvation problem, or does it shut off just like you turned the key or jumped off the seat? First play would be fuel system (tank suction hose is off or plugged, tank air bleed is losed/plugged, or the second play would be electrical (safety switches, PTO lever, overheat sensor, parking brake or even a short to ground from mice dining on a critical wire).