make renaming little bit more secure

 - show rename problems with r + count number
 - use "not os.path.lexists(savefile_tmp)" instead of "os.path.lexists(savefile)"
 - check the renamed file short before we raise the exception
 - increased the number how often we try to rename it

Change-Id: I58ec83b2e2a6df307c89b2ff6be432c90c23b1cd
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>