use tmp file, move tmp file to dest on success

needs tests
1.0.2