Wait for window to close

I have a table with multi-select enabled. I want to open a custom editor in a dialog for each entity that is selected in my table. Currently I am doing this with a a button invocation. I loop through al of the selected entities and open an editor for that instance of the entity. But all of the editors are being open at the same time rather than in an orderly one-at-a-time. Is there any way to hold the execution of the function until the current editor is closed?

No, you cannot hold execution - it’s the nature of web applications. But you can add a listener to an opened screen and continue execution only when it is closed:

AbstractEditor editor = openEditor(...);
editor.addCloseListener(actionId -> {
    // do after close
    // actionId here is the string identifier passed to the close() method of the opened screen