Fix threading test that sporadically fails on Travis.

threading.active_count will return the number of threads that would be
returned by threading.enumerate. These may include additional worker
threads that are unrelated to the user-spawned threads, and would cause
the loop to continue to wait even though all user-spawned threads were
totally complete.