windows: fix ReadConsole hangs on CloseHandle