Acquire lock in get_close_nodes()