Fix locking when cancelling a run.

Need to make sure that the delayed job object is locked to avoid horrible race
conditions. It wasn't being locked properly before.