lavf/mxfdec: Factorize mxf_read_close().

This will allow to fix leaks in a subsequent commit.
lavf/mxfdec: Fix memleaks reading corrupt files.

Fixes ticket #4173.

Reviewed-by: Tomas Härdin