Tidier onError solution
Make sure defer jobs refs are cleared too
Rename '_run' to 'flush' and run all jobs centrally
Tidy up
Add tests to check refs are being cleaned up