Tweaked behaviour of the text editor

The text editor now too will write to the "temp.npctxt" on closing.
Eventually, I will add this as a file type for the program just in case
and clickonce will handle associations. I took care to make sure that
all  streams are flushed/closed before anything is attempted to be
deleted (the temp files are deleted by the program on exit)