You're neither closing this file handler nor returning it, so there's a leak here (use `with open(...) as ..`)