Why are the contents of files deleted?

Set the default to file so you won't have to name it when you do a save.

Here is something I wrote (quite awhile ago) that you may find informative