src/vs/workbench/services/history/browser/history.ts/HistoryService/doReopenLastClosedEditor
class HistoryService:	private async doReopenLastClosedEditor(lastClosedEditor: IRecentlyClosedEditor): Promise<void> {

		// Determine editor options
		let options: IEditorOptions;
		if (lastClosedEditor.sticky) {
			// Sticky: in case the target index is outside of the range of
			// sticky editors, we make sure to not provide the index as
			// option. Otherwise the index will cause the sticky flag to
			// be ignored.
			if (!this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index)) {
				options = { pinned: true, sticky: true, ignoreError: true };
			} else {
				options = { pinned: true, sticky: true, index: lastClosedEditor.index, ignoreError: true };
			}
		} else {
			options = { pinned: true, index: lastClosedEditor.index, ignoreError: true };
		}

		// Re-open editor unless already opened
		let editorPane: IEditorPane | undefined = undefined;
		if (!this.editorGroupService.activeGroup.contains(lastClosedEditor.editor)) {
			// Fix for https://github.com/microsoft/vscode/issues/107850
			// If opening an editor fails, it is possible that we get
			// another editor-close event as a result. But we really do
			// want to ignore that in our list of recently closed editors
			//  to prevent endless loops.
			this.ignoreEditorCloseEvent = true;
			try {
				editorPane = await this.editorService.openEditor({
					...lastClosedEditor.editor,
					options: {
						...lastClosedEditor.editor.options,
						...options
					}
				});
			} finally {
				this.ignoreEditorCloseEvent = false;
			}
		}

		// If no editor was opened, try with the next one
		if (!editorPane) {
			// Fix for https://github.com/microsoft/vscode/issues/67882
			// If opening of the editor fails, make sure to try the next one
			// but make sure to remove this one from the list to prevent
			// endless loops.
			remove(this.recentlyClosedEditors, lastClosedEditor);

			// Try with next one
			this.reopenLastClosedEditor();
		}
	}