Fix locking up of the threadpool, when the job is cancelled while the
execution is blocked on Queue.Queue.get() call.