Make graphie not die on a trailing newline

Test Plan: In graphie-to-png locally, typeset something with `//` on the last line and have it not die. Clicking "Convert to Image" seems to not work for me on anything locally, not sure why. I assume it will work okay in prod.

Reviewers: jack

Reviewed By: jack

Differential Revision: http://phabricator.khanacademy.org/D8723