destroy dialog when closed (fix annoying repositioning when reopened), various fixes