fixed memory leak, forgot to close file