sounds like the door switch is misaligned. You could try pushing on the door to see if that stops it from cutting off. Otherwise, the electronics the switch is connected to is intermittent.
open