Address TSMF thread problems on repeat and leaks.

This version of the fix uses WaitForSingleObject() to perform the thread join.