code: def stop_recording(self):
          
          if not self._recording:
              raise Exception("Cannot stop a video recording when it's not recording!")
          self._cmd_q.put(('stop',))
          self._recording = False
docs: Stops writing video to file.