Counts the number of lines in a text file