Added windowClosing dialog functionality.