avcodec/utils, avcodec_open2: close codec on failure