Resolved issue where all threads shared one termination variable