fixed exit action when window is closed on the X in the upper right corner