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/perspectiveswitcher/PerspectiveSwitcher.java
psTB.pack();
		psTB.getShell().layout(new Control[] { psTB }, SWT.DEFER);
		return psItem;
	}
	
	private IPerspectiveDescriptor getDescriptorFor(String id) {
		return PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id);
	}
	private MPerspective getPerspectiveFor(IPerspectiveDescriptor desc) {
		MPerspectiveStack stack = getPerspectiveStack();
		if (stack != null) {
			
			for (MPerspective persp : stack.getChildren()) {
				if (persp.getElementId().equals(desc.getId())) {
					return persp;
				}
			}
		}
		return null;
	}
	
	
	private void openPerspective(PerspectiveDescriptor desc) {
		if (desc == null) {
			
			E4Util.unsupported("Couldn't open perspective");
			return;
		}
		MPerspective persp = AdvancedFactoryImpl.eINSTANCE.createPerspective();