Correctly return exit code from thd_join on Windows