fixed thread code (windows) to use INVALID_HANDLE_VALUE not nullptr for HANDLE compare