Fix deadlock in ThreadPool::Join.

Refs #4989