NEXUS-5472: Faster shutdown.

Canceling tasks on shutdown, if runs any.