Here is what I learned from @magnusbaeck:
He said it could be a problem with the file. So I looked at the
CSV file in wordpad, there was an extra line at the bottom. I removed
that, and it worked.You will also get this error if the file you are trying to process is not there. It happened when I used the wrong file name.