added command to close dialog
more changes to get dialogs correctly