title: AVAssetWriter finishWritingWithCompletionHandler Cannot call method when status is 0
body: <p>I am struggling with issue in new iOS 12 and Xcode 10. When I start screen recording it crashes and show me following log</p>
  
  <pre><code>2018-09-22 08:00:09.459676+0530 Chat story[95207:3292867] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriter finishWritingWithCompletionHandler:] Cannot call method when status is 0'
  </code></pre>
  
  <p>In last version of Xcode it was working fine. </p>
  
  <p>Also here is my code which I wrote for this </p>
  
  <pre><code>func startRecording(withFileName fileName: String, recordingHandler: @escaping (Error?) -&gt; Void,onCompletion: @escaping (Error?)-&gt;Void)
      {
          self.viewOverlay.show()
  
          screenRecorder.startRecording(withFileName: fileName) { (error) in
              recordingHandler(error)
              self.recordCompleted = onCompletion
          }
      }
  
      func stopRecording()
      {
          screenRecorder.stopRecording { (error) in
              self.viewOverlay.hide()
              self.recordCompleted?(error)
          }
      }
  </code></pre>
  
  <p>Also on ScreenRecorder.swift there is another method which calls stopRecording Method. Here is that method </p>
  
  <pre><code>func stopRecording(handler: @escaping (Error?) -&gt; Void)
          {
              if #available(iOS 11.0, *)
              {
                  RPScreenRecorder.shared().stopCapture
                  {    (error) in
                          handler(error)
                          self.assetWriter.finishWriting
                      {
                          print(ReplayFileUtil.fetchAllReplays())
  
                      }
                  }
              } else {
                  // Fallback on earlier versions
              }
          }
  </code></pre>