Add error handling and newlines at ends of files