Be more cautious when saving.

Two persons reported random problems when saving to a file on Windows
platform. These problems are rare, but can destroy a day of work.
This commit aims at minimizing the damage should a problem occur.
Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>