To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
I hope you're trying to remove a sub-window, not an application window, as was possible in Vaadin 6.
To remove a sub-window, I think it should work with getUI().removeWindow(getWindow()). Or, UI.getCurrent().removeWindow(getWindow()). Well, using getWindow() assumes that you're working in a location where you can use that.