Your snippet works as expected here.
It echoes "on OPEN" in the status window.
Then the /dcc reject command does nothing because of this: /help /dcc reject
Then the /close -ic $nick does nothing because the dcc window isn't inactive.
And there is nothing left to halt by the end of the script.
-genius_at_work