Don't leak thread handles on Windows