tls-dialog: destroy the dialog if the certificate is invalidated (#643186)