I believe the topmost dialogue is always closed when you use closeDialog 0. As to closing -all- open dialogs, well...um. I'm sure there's some smarter way as well, but:
for "_i" from 0 to 100 do {closeDialog 0; sleep 0.02};
Which simply runs 100 closedialogs consecutively, which should get rid of most open dialogs I'd say
(change to 10 or 2 or whatever if you want)
Wolfrug out.