Fix depend_on_que() to also follow the proper locking order. It also unlocked a job that it received locked.
Change depend_on_term() to be a bit more normal. Before, we would unlock the job and pass the id over to depend_on_term(), which would then lock, but then leave unlocked. The caller would then have to re-lock the job. Now, it receives the job locked and exits with the job locked.
Change release_cheapest so that it returns an error if the job disappears mid-execution.
Fix two errors with the patches I've just made to req_register.c in order to make functions follow the normal locking pattern.