fix win32 crash on close