(PHPhotosErrorDomain error -1.)

I am trying to save a video to camera roll from a CVPixelBuffer array using AVAssetWriter and PHPhotoLibrary. However, I keep getting this error when trying to save to camera roll. It worked earlier today, but I have not got it to work again. What can be the potential causes of this error?
(PHPhotosErrorDomain error -1.)
 
 
Q