Handle files without ending newlines properly.

Fixes #5.