The `encoder` is actually persistent and only freed when the output is freed, so testing for its existence is not enough to determine whether the output is open. The `fmtctx` can be used for that. Change-Id: I2cc3f00a0e983fafd5915736089a0421385b6ce3pull/1642/head