Code:
on *:CLOSE:*:{ echo -s $scriptline ONCLOSE active $active lactive $lactive lactivewid $lactivewid }


I'm not finding ON CLOSE being triggered by closing a DCC window either manually or close-on-complete. A better check would be if $lactivewid is zero.