fix loadFile to handle files with no EOL for the last line properly