// this part is separated from above to allow discarding via iterator in closeAll() private void closePlot(Frame plotFrame) { if (plotFrame.isVisible()) { plotFrame.setVisible(false); } plotFrame.dispose(); }