GPUImageMovieWriter: synchronise finishRecording with the movieWritingQueue [resubmit]

[Resubmitted so it can cleanly apply to master]

As the AVAssetWriter gets started on the movieWritingQueue, so we need to check its state on that queue.

Also need to set isRecording = NO before checking AVAssetWriter state, otherwise in a race condition where frames haven't started arriving and the AVAssetWriter hasn't started writing, we wouldn't stop recording.

Also ensure that the handler is called async, otherwise it is called on the movieWritingQueue, which is dispatch_sync from the video processing queue, so if the user-code in the handler calls anything that dispatch_syncs to the video processing queue: deadlock.