Close file after reading all lines.