Fix cancelling jobs

I'm not sure if I understand the code correctly, but if I do, this should fix an issue with cancelling jobs running on workers.

cc @joshk