waitForJobs function

Wait for Termination of Jobs