Window Close handler not working (for me)

Hello. Trying to handle window close event but nothing happens.
I copied simple example from book and tested in chrome and firefox. Nothing happens. Btw i using Don’t push ozone layer.


 public void init() { 
Window main = new Window("The Main Window"); 
setMainWindow(main);

main.addListener(new Window.CloseListener(){
   @Override
    public void windowClose(CloseEvent e) {
       System.out.println("Closing the application");
       getMainWindow().getApplication().close();
    } 
});

update.

Without Don’t push ozone layer all works fine…
Any idea ?

No one can help ?
And btw.
when i using getWindow().addListner() it doesnt works too.
Mb i writing not in right thread ?