Fix some race conditions in mlt_consumer.

OpenGL apps need to receive consumer-thread-stopped *after* all of the
frames are closed. Otherwise, it may cleanup the GL context before
frames holding context resources are closed.
Some consumer threads call mlt_consumer_purge().