Add safe mode on db. Backup db file in safe mode. Remove backup in case db is write correctly fixing #5