fixes for termination of win32 threading