fix autoclose on windows