Atom ships with the whitespace
package, which by default strips trailing whitespace from lines in your file, and inserts a final trailing newline to indicate end-of-file as per the POSIX standard.
You can disable this feature by going to the Packages list in the Settings View and finding the whitespace package:
Take a look at the Whitespace section for more information.