Added check to see if endIndex token is comment and append EOL if it is

This is to fix #630
Done.  You didn't mean the whole file correct?