TemporaryJobs: fix executor cleanup on job failure

* Run after() and before() on main thread instead of test thread.
* call after() in a finally to ensure that the executor is terminated.