public static void recurseClose(@Nonnull TreeView<?> tree, @Nonnull TreeItem<?> item) {
		MultipleSelectionModel<TreeItem<?>> selectionModel = Unchecked.cast(tree.getSelectionModel());
		boolean wasSelected = selectionModel.getSelectedItem() == item;
		recurseClose(item);

		// For some reason closing a tree item screws with selection in weird ways.
		// So we'll re-select the item afterward if it was previously the selected item.
		if (wasSelected) selectionModel.select(item);
	}
Closes children recursively.

@param tree
		Tree containing the item.
@param item
		Item to recursively close.
recaf-ui/src/main/java/software/coley/recaf/ui/control/tree/TreeItems.java