Layer activeLayer = Main.map.mapView.getActiveLayer();
if (activeLayer != null) {
active = layersOut.indexOf(activeLayer);
}
SessionWriter sw = new SessionWriter(layersOut, active, exporters, dependencies, zip);
try {
sw.write(file);
} catch (IOException ex) {
Main.error(ex);
HelpAwareOptionPane.showMessageDialogInEDT(
Main.parent,
tr("<html>Could not save session file ''{0}''.<br>Error is:<br>{1}</html>", file.getName(), ex.getMessage()),