Fix IronPython compatibility

does not support "with open(...) as fd: "  construct