Program: 62398
Project: 62398
Buggy source:
public MyTab createTab(){
  MyTab tab=new MyTab();
  tab.setController(controller);
  tab.setOnCloseRequest(event -> {
    event.consume();
    tab.close();
  }
);
  tab.selectedProperty().addListener((observableValue,before,after) -> {
    if (after) {
      if (Objects.nonNull(current.currentWebView())) {
        WebEngine webEngine=current.currentEngine();
        Worker.State state=webEngine.getLoadWorker().getState();
        if (state == Worker.State.SUCCEEDED) {
          controller.textListener(current.currentEditorValue());
        }
      }
      threadService.runActionLater(() -> {
        WebView webView=tab.getWebView();
        if (Objects.nonNull(webView))         webView.requestFocus();
      }
);
    }
  }
);
  MenuItem menuItem0=new MenuItem("String_Node_Str");
  menuItem0.setOnAction(actionEvent -> {
    tab.close();
  }
);
  MenuItem menuItem1=new MenuItem("String_Node_Str");
  menuItem1.setOnAction(actionEvent -> {
    ObservableList<Tab> tabs=controller.getTabPane().getTabs();
    ObservableList<Tab> clonedTabs=FXCollections.observableArrayList(tabs);
    if (clonedTabs.size() > 0) {
      clonedTabs.forEach((closedTab) -> {
        MyTab myTab=(MyTab)closedTab;
        myTab.close();
      }
);
    }
  }
);
  MenuItem menuItem2=new MenuItem("String_Node_Str");
  menuItem2.setOnAction(actionEvent -> {
    ObservableList<Tab> blackList=FXCollections.observableArrayList();
    blackList.addAll(controller.getTabPane().getTabs());
    blackList.remove(tab);
    blackList.forEach(t -> {
      MyTab closeTab=(MyTab)t;
      closeTab.close();
    }
);
  }
);
  MenuItem menuItem4=new MenuItem("String_Node_Str");
  menuItem4.setOnAction(actionEvent -> {
    TabPane tabPane=controller.getTabPane();
    if (tabPane.getSelectionModel().isSelected(tabPane.getTabs().size() - 1))     tabPane.getSelectionModel().selectFirst();
 else     tabPane.getSelectionModel().selectNext();
  }
);
  MenuItem menuItem5=new MenuItem("String_Node_Str");
  menuItem5.setOnAction(actionEvent -> {
    SingleSelectionModel<Tab> selectionModel=controller.getTabPane().getSelectionModel();
    if (selectionModel.isSelected(0))     selectionModel.selectLast();
 else     selectionModel.selectPrevious();
  }
);
  MenuItem menuItem6=new MenuItem("String_Node_Str");
  menuItem6.setOnAction(actionEvent -> {
    List<Optional<Path>> closedPaths=MyTab.getClosedPaths();
    if (closedPaths.size() > 0) {
      int index=closedPaths.size() - 1;
      closedPaths.get(index).filter(pathResolver::isAsciidoc).ifPresent(this::addTab);
      closedPaths.get(index).filter(pathResolver::isMarkdown).ifPresent(this::addTab);
      closedPaths.get(index).filter(pathResolver::isImage).ifPresent(this::addImageTab);
      closedPaths.remove(index);
    }
  }
);
  MenuItem menuItem7=new MenuItem("String_Node_Str");
  menuItem7.setOnAction(event -> {
    current.currentPath().ifPresent(path -> {
      controller.getHostServices().showDocument(path.getParent().toUri().toASCIIString());
    }
);
  }
);
  MenuItem menuItem8=new MenuItem("String_Node_Str");
  menuItem8.setOnAction(controller::newDoc);
  MenuItem gotoWorkdir=new MenuItem("String_Node_Str");
  gotoWorkdir.setOnAction(event -> {
    current.currentPath().map(Path::getParent).ifPresent(directoryService::changeWorkigDir);
  }
);
  ContextMenu contextMenu=new ContextMenu();
  contextMenu.getItems().addAll(menuItem0,menuItem1,menuItem2,new SeparatorMenuItem(),menuItem4,menuItem5,menuItem6,new SeparatorMenuItem(),gotoWorkdir,new SeparatorMenuItem(),menuItem7,menuItem8);
  tab.contextMenuProperty().setValue(contextMenu);
  Label label=new Label();
  tab.setLabel(label);
  label.setOnMouseClicked(mouseEvent -> {
    if (mouseEvent.getButton().equals(MouseButton.SECONDARY)) {
      controller.getTabPane().getSelectionModel().select(tab);
    }
 else     if (mouseEvent.getClickCount() > 1) {
      controller.adjustSplitPane();
    }
  }
);
  return tab;
}

Fixed version (ground truth):
public MyTab createTab(){
  MyTab tab=new MyTab(){
    @Override public void close(){
      super.close();
      if (controller.getTabPane().getTabs().isEmpty()) {
        controller.newDoc(null);
      }
    }
  }
;
  tab.setOnCloseRequest(event -> {
    event.consume();
    tab.close();
  }
);
  tab.selectedProperty().addListener((observableValue,before,after) -> {
    if (after) {
      if (Objects.nonNull(current.currentWebView())) {
        WebEngine webEngine=current.currentEngine();
        Worker.State state=webEngine.getLoadWorker().getState();
        if (state == Worker.State.SUCCEEDED) {
          controller.textListener(current.currentEditorValue());
        }
      }
      threadService.runActionLater(() -> {
        WebView webView=tab.getWebView();
        if (Objects.nonNull(webView))         webView.requestFocus();
      }
);
    }
  }
);
  MenuItem menuItem0=new MenuItem("String_Node_Str");
  menuItem0.setOnAction(actionEvent -> {
    tab.close();
  }
);
  MenuItem menuItem1=new MenuItem("String_Node_Str");
  menuItem1.setOnAction(actionEvent -> {
    ObservableList<Tab> tabs=controller.getTabPane().getTabs();
    ObservableList<Tab> clonedTabs=FXCollections.observableArrayList(tabs);
    if (clonedTabs.size() > 0) {
      clonedTabs.forEach((closedTab) -> {
        MyTab myTab=(MyTab)closedTab;
        myTab.close();
      }
);
    }
  }
);
  MenuItem menuItem2=new MenuItem("String_Node_Str");
  menuItem2.setOnAction(actionEvent -> {
    ObservableList<Tab> blackList=FXCollections.observableArrayList();
    blackList.addAll(controller.getTabPane().getTabs());
    blackList.remove(tab);
    blackList.forEach(t -> {
      MyTab closeTab=(MyTab)t;
      closeTab.close();
    }
);
  }
);
  MenuItem menuItem4=new MenuItem("String_Node_Str");
  menuItem4.setOnAction(actionEvent -> {
    TabPane tabPane=controller.getTabPane();
    if (tabPane.getSelectionModel().isSelected(tabPane.getTabs().size() - 1))     tabPane.getSelectionModel().selectFirst();
 else     tabPane.getSelectionModel().selectNext();
  }
);
  MenuItem menuItem5=new MenuItem("String_Node_Str");
  menuItem5.setOnAction(actionEvent -> {
    SingleSelectionModel<Tab> selectionModel=controller.getTabPane().getSelectionModel();
    if (selectionModel.isSelected(0))     selectionModel.selectLast();
 else     selectionModel.selectPrevious();
  }
);
  MenuItem menuItem6=new MenuItem("String_Node_Str");
  menuItem6.setOnAction(actionEvent -> {
    List<Optional<Path>> closedPaths=MyTab.getClosedPaths();
    if (closedPaths.size() > 0) {
      int index=closedPaths.size() - 1;
      closedPaths.get(index).filter(pathResolver::isAsciidoc).ifPresent(this::addTab);
      closedPaths.get(index).filter(pathResolver::isMarkdown).ifPresent(this::addTab);
      closedPaths.get(index).filter(pathResolver::isImage).ifPresent(this::addImageTab);
      closedPaths.remove(index);
    }
  }
);
  MenuItem menuItem7=new MenuItem("String_Node_Str");
  menuItem7.setOnAction(event -> {
    current.currentPath().ifPresent(path -> {
      controller.getHostServices().showDocument(path.getParent().toUri().toASCIIString());
    }
);
  }
);
  MenuItem menuItem8=new MenuItem("String_Node_Str");
  menuItem8.setOnAction(controller::newDoc);
  MenuItem gotoWorkdir=new MenuItem("String_Node_Str");
  gotoWorkdir.setOnAction(event -> {
    current.currentPath().map(Path::getParent).ifPresent(directoryService::changeWorkigDir);
  }
);
  ContextMenu contextMenu=new ContextMenu();
  contextMenu.getItems().addAll(menuItem0,menuItem1,menuItem2,new SeparatorMenuItem(),menuItem4,menuItem5,menuItem6,new SeparatorMenuItem(),gotoWorkdir,new SeparatorMenuItem(),menuItem7,menuItem8);
  tab.contextMenuProperty().setValue(contextMenu);
  Label label=new Label();
  tab.setLabel(label);
  label.setOnMouseClicked(mouseEvent -> {
    if (mouseEvent.getButton().equals(MouseButton.SECONDARY)) {
      controller.getTabPane().getSelectionModel().select(tab);
    }
 else     if (mouseEvent.getClickCount() > 1) {
      controller.adjustSplitPane();
    }
  }
);
  return tab;
}