Validate file ends with newline character

Fix #38