moved freeing of file pointer to end of last processed reads file section