(Copied from my comment on the question, as requested.)
See Why should files end with a newline? - Stack Overflow. The "TL;DR": POSIX says so, and it's pretty logical to have a line end in and end-of-line character.
See the linked Stack Overflow question for practical consequences.