When using "custom I/O", avformat_close_input will not call avio_close so it is up to us to clean up.