Fix freezing issues on Windows.