Implements onDismissCallback.