Close ffmpeg context in the case of error