call dialog before closing