Metadata extractor plugin and some minor fixes

Without a context manager wrapping this line, does our file handle leak?