Add check for newline when document is saved.

A newline at the end of the document is required. This is now auto-added
when the stim file is saved.
Add more checks for operators that are not allowed