Lock the dictionary when prune