added forcing offline to False for csv reader, and changed flush to close at the end