Implement new way to close dialog to verify the data.