Get next line from the file. Close it if EOF reached.