Prevent the preemption timer to run when termination is requested

* The call to `deadline_timer.cancel()` might not do anything if the timer was about to expire (and the callback is then executed "normally").