Fix re-introduced ThreadError on Ruby 2

See #228.

The previous solution didn't actually wait for the thread to finish, so
it might have exited before the thread had finished its work. So I've
added a #join too.