Hm.. I've not had a chance to test my code. It either needs halt or haltdef and then it won't even open a window. That's why I didn't include a /window -c $nick command (or /closemsg... tho I prefer using /window for such things). If halt lets the window open, change it to haltdef and it shouldn't open.
on ^*:text:*:?:halt
will not prevent the window from opening, it will just not show the text they said.
You probably meant to use the on open event, where a halt/haltdef will indeed prevent the window from opening in the first place, so that window -c $nick or closemsg etc will be obsolete.
on ^*:open:?:*: if ($nick ison #channel) haltNote that the matchtext part (*) isn't necessary here, but it is good practice to include it anyway. If the parameters on the same line as the on open event contain a :, and you did not specify the matchtext part, it would certainly give unrequired results.