make common dialog close function