Or, more simply, just call iOS's delegate method manually when you dismiss the popover manually.
dismissViewControllerAnimated(true, completion: nil)
popoverPresentationController?.delegate?.popoverPresentationControllerDidDismissPopover?(popoverPresentationController!)