That's an easy fix.. There's nothing exclusive to deal with query windows that I know of.

Code:
on *:open:?:*:{
  set %oquery. [ $+ [ $cid ] ] %oquery. [ $+ [ $cid ] ] $nick
  ; if you want to "check" to see if this query window is open at a later time, use a signal or something.
  ;.signal querycheck $cid $nick
  ; You can put that on a timer or something if you really want to run a check on it.
}
on *:active:?:{
  if ($istok(%oquery. [ $+ [ $cid ] ],$active,32)) {
    set %oquery. [ $+ [ $cid ] ] $remtok(%oquery. [ $+ [ $cid ] ],$active,32)
  }
}