destructor for ThreadPool