Well, the code as you have it there won't close the windows because you've changed your window names throughout the code, except in the alias that closes them. Change those ones too, and it should work.

BTW, I would make an alias that formats the window name for you, and then use it instead of having $+ $+ $+ $+ all over the place. The ()'s also make it more difficult to refer to the window.

alias winname return $replace($1-,$chr(32),$chr(160))

And then in your code:

window -k +s $winname(@MOTD $network) blah blah blah

-genius_at_work