Fixed bug where av_lockmgr unregistration occurred before avcodec_close at server exit