Fix for files without newline at the end
Optimization: nodejs should read file by itself, instead of transferring via pexpect. Much faster