on *:text:*:?: { $iif(!$comchan($nick,0),close -m $nick) }
on the server i chat on you cant send messages, or talk to someone unless you are in the same room as them, so i dont have that problem, not that command will be executed whenever someone "whispers"/PM's to you any message, and if you arent on a channel with him/her, the chat window associated with him/her will be closed!