Prevent window from closing in windowClose() of CloseListener

I’ve a modal window on which I added a CloseListener. During the methode windowClose() I would like to do some checks and deside whether the window should be closed or - because of exceptions - the whole closing should be cancelled.
Is there a way to cancel the closing of a (modal) window during windowClose()?

Unfortunately CloseListeners are invoked too late; the window has already been removed from the UI at that point. I think you could write a Window subclass and override the close() method to do the checks required, only calling super.close() if the window should be actually closed.

Thanks Johannes. I’ll override close() and write my own CloseListener where I’ve the option to cancel the close operatrion.