23.2 cannot close dialog or notification from thread

False alarm, Answering myself. The code below fails to close the dialog unless Push is enabled. By the time the Thread.sleep() is done, the main request has been served by the web server and the connection to the browser is closed. Enabling Push keeps a channel open to the UI so the second ui.access() actually can send the close command.

    public void onAttach(AttachEvent ae) {
        Dialog d = new Dialog(new Paragraph("test dialog"));
        UI ui = UI.getCurrent();
        new Thread(() -> {
            ui.access(() -> d.open());
            try {
            } catch (InterruptedException e) {
            ui.access(() -> d.close());

And Push is enabled as follows https://vaadin.com/docs/latest/advanced/server-push