py2neo.database.status.TransientError: Query Help

I am running neo4j batch query where I have a bunch of nodes that are already in db and are having two relations with the target node. The relations are like this

Target_Node- [is_followed_by]->Friend_Node
Target_Node- [is_friend_with]->Friend_Node

I want to add one more relation [activity_p] between target and friend node. I am having friends node data which I do send in threads (20 in each thread) but when I run my query I get this error

py2neo.database.status.TransientError: ForsetiClient[334] can't acquire ExclusiveLock{owner=ForsetiClient[333]} on NODE(1300036), because holders of that lock are waiting for ForsetiClient[334]

l is the json of friend nodes; user is the target user

"""UNWIND [{id: '""" + id + """' , uid : toInt('""" + str(uid) + """')}] as user

            UNWIND """+ l +""" as c

            OPTIONAL MATCH (n:Target {id : , uid : toInt('""" + str(uid) + """'),type:"0"})

            OPTIONAL MATCH (m:Friend {id : , screen_name:c.screen_name, uid : toInt('""" + str(uid) + """'),type:"0"})

            WITH coalesce(n, m) as node,user,c // returns first non-null value

            CALL is null, "MERGE (n:Friend {,, profile: c.profile, type:c.type}) RETURN n", '', {c:c,user:user}) YIELD value

            with coalesce(node, value.n) as y,user,c

            MERGE (u:""" + label + """ {id: , uid : user.uid})


            foreach (sc in c.cityn | merge(cn:Location {location:sc.location, loc_lower : sc.loc_lower}) merge (y)-[:`located_at`]-(cn))


Any help will be appreciated..