Add proper task resource removal in case that a task submission fails
Let the submitJobAndWait method check continuously whether the job manager is still alive. Terminate waiting for a response in case of a job manager outage.