Registry cleanup race

@arabidopsis @nvie @selwin 

I thought I'd take a pass at resolving #454 since I intend to use the job registries pretty heavily. I've also snuck two other small changes in here in separate commits.

Note that while this should ensure that all jobs cleaned from a started registry end up in the failed queue it does mean that `started_job_registry.get_job_ids()` will return any jobs that expire during the `cleanup()` process.