Update job state after task not found on agent

This used to be done as part of an event handler triggered whenever the
task's state was updated, but it no longer is, because of a race
condition, so now we need to do it manually.
Merge pull request #319 from guidow/missing_tasks_fixes

Update job state after task not found on agent