Hello,
while $get($nick,%i).wid != $get(-1).wid { inc %i }
close -g $+ %i $nick
This is excellent!! I'll workship you henceforth

For those who are interested, here's the final code I settled for:
on 1:FILERCVD:*:{
var %i = 1
while (%i <= $get($nick,0)) {
if ($get($nick,%i).wid == $get(-1).wid) {
close -g $+ %i $nick
break
}
inc %i
}
}
Thanks and regards.