Handle lack of trailing newline in dat files. Fixes #336