diff --git a/src/mongo_client.ts b/src/mongo_client.ts
index 7e73b4c9b5e..ffd0ab06e1b 100644
--- a/src/mongo_client.ts
+++ b/src/mongo_client.ts
@@ -450,6 +450,9 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
     topology.client = this;
 
     topology.once(Topology.OPEN, () => this.emit('open', this));
+    topology.on(Topology.TOPOLOGY_CLOSED, () => {
+      this.connectionLock = undefined;
+    });
 
     for (const event of MONGO_CLIENT_EVENTS) {
       topology.on(event, (...args: any[]) => this.emit(event, ...(args as any)));
diff --git a/test/integration/node-specific/mongo_client.test.ts b/test/integration/node-specific/mongo_client.test.ts
index f92ccee05ac..6ba88f9b9f4 100644
--- a/test/integration/node-specific/mongo_client.test.ts
+++ b/test/integration/node-specific/mongo_client.test.ts
@@ -574,6 +574,16 @@ describe('class MongoClient', function () {
       expect(topologyOpenEvents).to.have.lengthOf(1);
       expect(client.topology?.isConnected()).to.be.true;
     });
+
+    it('releases the lock if the topology is closed before connection is complete', function (done) {
+      clientConnect();
+      client.close();
+      client.once('topologyClosed', async () => {
+        await clientConnect();
+        expect(client.topology?.isConnected()).to.be.true;
+        done();
+      });
+    });
   });
 
   context('#close()', () => {