Added termination of Threads after all jobs were completed