window and subwindow z-index

in my application, when I open, close, reopen and so forth the same (modal) window multiple times, I see that its z-index is incremented each time.
How is that value handled / generated by Vaadin? Is there any well-defined logic one could rely on (meaning it’s not something internal that could change in the future) to specify the z-index of other elements?
Do those value increments mean that each time I open the same window I’m in fact keeping the previous ones somewhere around and that I’m not correctly closing it?

Thanks :slight_smile: