Added lock mechanism to UserDB saving.