Sorry for the delay in my response.

Let me clarify what I meant when I said the program needed an "extra line". The Creating the extra line in emacs 24.5 creates a line ending. Without that line ending, I get a script error.​

I have attached two scripts, one with and one without the final line ending. I've also attached screenshots of what these files look like using M-x whitespace-mode.

Running the one without the line ending (suffixed noextra) returns the syntax error.

Once I figured out I needed the extra line ending, it wasn't a big deal to put it in, but it did trip me up for a few minutes.