Using $window(*,N) only one loop is needed to go through all of them (thanks qwerty- for pointing that out).
var %i = 1
while $window(*,%i) {
if $ifmatch != @Window { clear $+(",$ifmatch,") }
inc %i
}
This one "clears" any open window, but that doesn't affect DCC send, URL list or other special ones.