Fix TheadPool destruction.

Error was initially not noticed because destruction was upon program
exit, but the pointer was being deleted through shared_ptr for each
thread and by the destruction in its local context.
Fix test_ThreadPool.