void () { final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); try { PlatformTestUtil.startPerformanceTest("xml formatter", 20000, createTestRunnable()).useLegacyScaling().assertTiming(); } finally { final VirtualFile[] selectedFiles = editorManager.getSelectedFiles(); if (selectedFiles.length > 0) editorManager.closeFile(selectedFiles[0]); } }