public void windowClosing(WindowEvent e) {
        // We have to call dispose() before using the WindowManagementCallback, because the
        //  WindowManagementCallback may well call System.exit().  If System.exit() is called
        //  before dispose() closes our temporary files, then they won't be deleted.
        // So, we need to temporarily save what we'll need, for our later invocation of
        //  WindowManagementCallback.disposeWindow(), that dispose() would otherwise trash
        WindowManagementCallback wc = windowManagementCallback;
        JFrame v = viewer;

        // assign view properties so that they can be saved on close
        org.icepdf.core.views.DocumentViewController viewControl = getDocumentViewController();
        Properties viewProperties = new Properties();
        viewProperties.setProperty(PropertiesManager.PROPERTY_DEFAULT_PAGEFIT, String.valueOf(viewControl.getFitMode()));
        viewProperties.setProperty("document.viewtype", String.valueOf(viewControl.getViewMode()));

        dispose();

        if (wc != null) {
            wc.disposeWindow(this, v, viewProperties);
        }
    }