how do i fix a valueerror: read of closed file exception?,fo.write(fp.read())