MinGW: fix crash on close