trying to fix close window problem