Flush buffers prior to closing the codec.

Avoid random crashes seen with HLS streams