mimetype check should not keep files open