Fix "Fatal Python Error: PyEval_RestoreThread: NULL tstate" on Windows.