remove extra newlines at the end of the file