I just happen to have my machine ready to go here....so I tried your code.
It ran fine on my router.
Others may suggest something that I'm not seeing.
Since your machine is still active and able to jog, I can't see why it would "hold". The spindle continues? do the DROs continue to move even though the machine is stopped? I don't know.....
I'm still re-aquainting myself with my router.
Watchdog might provide some info...it is enabled in the general configuration -far right.
There are similar spots further on in your code. You might try "starting from here" at or near those areas of your code.