Lock the nickMap when saving it

Also moves the mutex lock/unlock while loading the file to only lock in
the needed scope.