Check if the codec is open before flushing it