Create relationship too slow for existing nodes using cypher-shell

Hi there! I'm struggling to create relationships among existing nodes in Neo4j (v.4.1.1). I'm creating nodes and edges via cypher-shell and a text file containing cypher commands. First I created around 20K nodes. Cypher-shell ran without issues. But then when trying to connect nodes with another script, cypher-shell freezes or hangs without giving any information about its progress. The script to create (bi-directional) connections consists of 2 parts: one in which I match nodes, and another in which I create the corresponding connections. I also created an index on a node property called "image_id" beforehand.

An example of a command to create a node in the first script looks like this:

-- create_nodes.txt:

CREATE (i_20040:Image {image_id: 'MDteiLH1CZY', image_name: 'SetA_MDteiLH1CZY.jpg', cluster: 99})

whereas an example to create connections looks like this:

-- create_edges.txt:

(from the matching section) MATCH (node_0: Image {image_id: '-kBXeZqJtMY'})

(and then from the connecting section) MERGE (node_0)-[:IS_SIMILAR]->(node_1) MERGE (node_1)-[:IS_SIMILAR]->(node_0)

There are around 40K connections to create. I'm running cypher-shell from the terminal in Neo4j desktop (Windows 10) like this:

> cypher-shell -f create_edges.txt

I would appreciate any hints on what I am missing or doing wrong. Thank you!