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
ToolItem newItem = new ToolItem(trimStackTB, SWT.CHECK);
			newItem.setData(item);
			newItem.setImage(item.getImage());
			newItem.setToolTipText(item.getText());
			newItem.addSelectionListener(new SelectionListener() {
				public void widgetSelected(SelectionEvent e) {
					ToolItem item = (ToolItem) e.widget;
					CTabItem cti = (CTabItem) item.getData();
					MUIElement me = (MUIElement) cti.getData(AbstractPartRenderer.OWNING_ME);
					if (me instanceof MPlaceholder)
						me = ((MPlaceholder) me).getRef();
					boolean show = item.getSelection();
					partService.activate((MPart) me);
					showStack(show);
				}
				public void widgetDefaultSelected(SelectionEvent e) {
					ToolItem item = (ToolItem) e.widget;
					CTabItem cti = (CTabItem) item.getData();
					MUIElement me = (MUIElement) cti.getData(AbstractPartRenderer.OWNING_ME);
					if (me instanceof MPlaceholder)
						me = ((MPlaceholder) me).getRef();
					boolean show = item.getSelection();
					partService.activate((MPart) me);
					showStack(show);
				}
			});
		}
		if (hostPane != null && hostPane.isVisible())
			updateSelection(theStack.getSelectedElement());
		trimStackTB.pack();