Bugfix: Non-unique window indices

By opening two new windows, 1 and 2, then closing 1 and opening a new
window, you would get two windows with the same index 2, causing only
one of them to be updated.

Fixed by never re-using the same index