TextEdit keeps duplicating my text file and adding a strange extension
If you also get errors like this, it's probably the same issue I had.

The document “temp.txt” could not be opened. You don’t have permission.
To view or change permissions, select the item in the Finder and choose File &gt; Get Info.

There were messages like this in system.log, so it could be related to Versions or sandboxing:
9/13/12 10:41:55.118 PM TextEdit[357]: NSFileVersion tried to tried to add a new generation and failed. Versioned file URL: file://localhost/Users/lauri/Notes/temp.txt, contents URL: file://localhost/Users/lauri/Notes/temp.txt.sb-de6477ff-BhVNrq, error: Error Domain=GSLibraryErrorDomain Code=1 &quot;The operation couldn’t be completed. (GSLibraryErrorDomain error 1.)&quot;
9/13/12 10:41:55.118 PM TextEdit[357]: NSDocument failed to preserve the old version of a document. Here's the error:
Error Domain=GSLibraryErrorDomain Code=1 &quot;The operation couldn’t be completed. (GSLibraryErrorDomain error 1.)&quot;
9/13/12 10:41:55.119 PM TextEdit[357]: &lt;Document: 0x7f971d00a510&gt;: An error occurred while attempting to preserve the backup file at file://localhost/Users/lauri/Notes/temp.txt.sb-de6477ff-BhVNrq: Error Domain=GSLibraryErrorDomain Code=1 &quot;The operation couldn’t be completed. (GSLibraryErrorDomain error 1.)&quot;

I ended up replacing TextEdit with TextEditPlus, and I haven't gotten those errors or extra temp files after that. It's based on a version of TextEdit that came with Lion, but it's still mostly identical to the current version.