Didn't try the code myself, or I might have a more definitive answer,
but I have a couple thoughts.
First, I assume this code is in a module that is not being closed by
your ActiveWindows.Close call?
And second, I wonder if the ActiveWindow.Close call is throwing off the
For Each loop. One way to check would be to comment out that line, run
it again, and see if it works.
But that's where I would look -- at the ActiveWindow.Close call.