Closed window won't disapear

In my application, clicking on a button creates a popup window and clicking back the button makes it disapear. Simple! The problem I have is that the closed window does not disapear from the gui. I used the debugger to see what happen and all I see is that the window is in the closed stated and detached. I tried the close button of the window and the same thing happen so it is not my logic that is the problem. Something prevent the window from disapearing. When I click on menu items to change view, the window is still there.

What could be wrong?

Here is a code snippet if it helps:

        if ( !notificationsWindow.isAttached() ) {
            notificationsWindow.setPositionY( pEvent.getClientY() - pEvent.getRelativeY() + 40 );
            UI.getCurrent().addWindow( notificationsWindow );
            notificationsWindow.focus();
        } else {
            notificationsWindow.close();
        }

No one knows? Is that a Vaadin bug?

I added some listeners to know what happens:

            notificationsWindow.addCloseListener( event -> System.out.println( "closed" ) );
            notificationsWindow.addDetachListener( event -> System.out.println( "detached" ) );

And the window gets detached and closed but it won’t disapear!