Don't forget to CloseHandle threads on win32, spotted by Attila