fix persisters writing temporary writing

This may fix most of the GEOS-6373 cases:
http://jira.codehaus.org/browse/GEOS-6373

Note that we can still have some trouble with windows rename since it is still not atomic function.

About tests:  these functions are really low level functions called by many higher level tests so they are implicitly tested.