Bug 318363 [UI] Closing Perspectives changes others
If you open the Debug perspective and then close it the Package Explorer disappears. Root cause was that I opened the second perspective using the perspective switcher which performed the operation 'locally' rather than going through the WorkbenchPage#setPerspective code. This meant that the 'openPerspectives' list wasn't updated which meant that the 'closePerspective' call delegated to 'closeAllPerspectives' since it thought there was only one open.
bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
void createWidget(Composite parent, MToolControl me) {
		if (theStack == null) {
			theStack = findStack();
		}
		MUIElement meParent = me.getParent();
		int orientation = SWT.HORIZONTAL;
		if (meParent instanceof MTrimBar) {
			bar = (MTrimBar) meParent;
			if (bar.getSide() == SideValue.RIGHT || bar.getSide() == SideValue.LEFT)
				orientation = SWT.VERTICAL;
		}
		trimStackTB = new ToolBar(parent, orientation | SWT.FLAT | SWT.WRAP);
		ToolItem restoreBtn = new ToolItem(trimStackTB, SWT.PUSH);
		restoreBtn.setImage(getRestoreImage(parent.getDisplay()));
		restoreBtn.addSelectionListener(new SelectionListener() {
			public void widgetSelected(SelectionEvent e) {
				restoreStack();
			}
			public void widgetDefaultSelected(SelectionEvent e) {
				restoreStack();
			}
		});
		updateTrimStackItems();
	}
	/**
	 * @return
	 */
	private MPartStack findStack() {
		List<MPerspectiveStack> ps = modelService.findElements(window, null,
				MPerspectiveStack.class, null);