readLines can take the name of the file rather than the connection (then you don't need to worry about closing the connection