public void quit(SwingController controller, JFrame viewer, Properties properties) {
    if (controller != null && viewer != null) {
      // save width & height
      Rectangle sz = viewer.getBounds();
      getProperties().setInt("application.x", sz.x);
      getProperties().setInt("application.y", sz.y);
      getProperties().setInt("application.height", sz.height);
      getProperties().setInt("application.width", sz.width);
      if (properties != null) {
        getProperties()
            .set(
                PropertiesManager.PROPERTY_DEFAULT_PAGEFIT,
                properties.getProperty(PropertiesManager.PROPERTY_DEFAULT_PAGEFIT));
        getProperties().set("document.viewtype", properties.getProperty("document.viewtype"));
      }
      getProperties().setDefaultFilePath(ViewModel.getDefaultFilePath());
      getProperties().setDefaultURL(ViewModel.getDefaultURL());
    }

    // save all the rest, cookies, bookmarks, etc.
    getProperties().saveAndEnd();

    // make sure all the controllers have been disposed.
    for (int i = 0; i < controllers.size(); i++) {
      SwingController c = controllers.get(i);
      if (c == null) continue;
      c.dispose();
    }

    /* CUCFL : don't exit the program, just dispose the viewer and return to th emain program... */
    // System.exit(0);

    if (viewer != null) {
      viewer.setVisible(false);
      viewer.dispose();
    }
  }