Shuts down the encoder thread, and releases encoder resources.
Does not return until the encoder thread has stopped.