diff --git a/CHANGES b/CHANGES
index 07ab26c9e03bf2c26666f5fa98cb8186237414c2..d87d846c4803a06a7f857ea9adec10c18064070f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ OpenLDAP 2.4 Change Log
 OpenLDAP 2.4.18 Engineering
 	Fixed slapd incorrectly applying writetimeout when not set (ITS#6220)
 	Fixed slapd subordinate needs a suffix (ITS#6216)
+	Fixed slapd tools to properly close database (ITS#6214)
 	Fixed slapd-ndb startup (ITS#6203)
 	Build Environment
 		Fixed test056-monitor with custom ports (ITS#6213)
diff --git a/servers/slapd/slapacl.c b/servers/slapd/slapacl.c
index cc49b215256d48a07534dbd634c5deedd2d89da9..c02d5db3b14485e012a1b15e8453269746388447 100644
--- a/servers/slapd/slapacl.c
+++ b/servers/slapd/slapacl.c
@@ -73,6 +73,7 @@ slapacl( int argc, char **argv )
 	char			*attr = NULL;
 	int			doclose = 0;
 	BackendDB		*bd;
+	void			*thrctx;
 
 	slap_tool_init( progname, SLAPACL, argc, argv );
 
@@ -96,7 +97,8 @@ slapacl( int argc, char **argv )
 	argv = &argv[ optind ];
 	argc -= optind;
 
-	connection_fake_init( &conn, &opbuf, &conn );
+	thrctx = ldap_pvt_thread_pool_context();
+	connection_fake_init( &conn, &opbuf, thrctx );
 	op = &opbuf.ob_op;
 	op->o_tmpmemctx = NULL;
 
diff --git a/servers/slapd/slapauth.c b/servers/slapd/slapauth.c
index e6a1b8916f3904e360e2cd56c6c648c8d3596d77..9b82e7db7079a53c4a9f0a61abc12289be64f9fb 100644
--- a/servers/slapd/slapauth.c
+++ b/servers/slapd/slapauth.c
@@ -83,13 +83,15 @@ slapauth( int argc, char **argv )
 	Connection		conn = {0};
 	OperationBuffer	opbuf;
 	Operation		*op;
+	void			*thrctx;
 
 	slap_tool_init( progname, SLAPAUTH, argc, argv );
 
 	argv = &argv[ optind ];
 	argc -= optind;
 
-	connection_fake_init( &conn, &opbuf, &conn );
+	thrctx = ldap_pvt_thread_pool_context();
+	connection_fake_init( &conn, &opbuf, thrctx );
 	op = &opbuf.ob_op;
 
 	conn.c_sasl_bind_mech = mech;
diff --git a/servers/slapd/slapschema.c b/servers/slapd/slapschema.c
index 6a00be85c7e0f5e66660b47a4ecd3964e8a41a50..c3b7aaed88b5247fe4887b75a0c99d5d0c40683a 100644
--- a/servers/slapd/slapschema.c
+++ b/servers/slapd/slapschema.c
@@ -49,6 +49,7 @@ slapschema( int argc, char **argv )
 	Connection conn = { 0 };
 	OperationBuffer	opbuf;
 	Operation *op = NULL;
+	void *thrctx;
 
 	slap_tool_init( progname, SLAPCAT, argc, argv );
 
@@ -78,7 +79,8 @@ slapschema( int argc, char **argv )
 		exit( EXIT_FAILURE );
 	}
 
-	connection_fake_init( &conn, &opbuf, &conn );
+	thrctx = ldap_pvt_thread_pool_context();
+	connection_fake_init( &conn, &opbuf, thrctx );
 	op = &opbuf.ob_op;
 	op->o_tmpmemctx = NULL;
 	op->o_bd = be;