src/vs/platform/windows/electron-main/window.ts/CodeWindow/destroyWindow
class CodeWindow:	private async destroyWindow(reopen: boolean, skipRestoreEditors: boolean): Promise<void> {
		const workspace = this._config?.workspace;

		//  check to discard editor state first
		if (skipRestoreEditors && workspace) {
			try {
				const workspaceStorage = this.storageMainService.workspaceStorage(workspace);
				await workspaceStorage.init();
				workspaceStorage.delete('memento/workbench.parts.editor');
				await workspaceStorage.close();
			} catch (error) {
				this.logService.error(error);
			}
		}

		// 'close' event will not be fired on destroy(), so signal crash via explicit event
		this._onDidDestroy.fire();

		// make sure to destroy the window as it has crashed
		this._win?.destroy();

		// ask the windows service to open a new fresh window if specified
		if (reopen && this._config) {

			// We have to reconstruct a openable from the current workspace
			let uriToOpen: IWorkspaceToOpen | IFolderToOpen | undefined = undefined;
			let forceEmpty = undefined;
			if (isSingleFolderWorkspaceIdentifier(workspace)) {
				uriToOpen = { folderUri: workspace.uri };
			} else if (isWorkspaceIdentifier(workspace)) {
				uriToOpen = { workspaceUri: workspace.configPath };
			} else {
				forceEmpty = true;
			}

			// Delegate to windows service
			const [window] = this.windowsMainService.open({
				context: OpenContext.API,
				userEnv: this._config.userEnv,
				cli: {
					...this.environmentMainService.args,
					_: [] // we pass in the workspace to open explicitly via `urisToOpen`
				},
				urisToOpen: uriToOpen ? [uriToOpen] : undefined,
				forceEmpty,
				forceNewWindow: true,
				remoteAuthority: this.remoteAuthority
			});
			window.focus();
		}
	}