diff --git a/src/tests/test_dbremove_old.c b/src/tests/test_dbremove_old.c
index 878bf5e728c395491ed51aa140c92bf6f09653d2..148dd4810d88f4f155341accb381e6ad58d9c78e 100644
--- a/src/tests/test_dbremove_old.c
+++ b/src/tests/test_dbremove_old.c
@@ -76,5 +76,8 @@ test_main (int UU(argc), char UU(*argv[])) {
         }
         closedir(direct);
     }
+
+    r = env->close(env, 0); assert(r == 0);
+
     return 0;
 }
diff --git a/src/tests/test_dup_dup.c b/src/tests/test_dup_dup.c
index 31e30a2e711edd40184eb1687127f03ca0841563..1d80aa2ea11ed93b9fe33aab2c780f81d4c05e74 100644
--- a/src/tests/test_dup_dup.c
+++ b/src/tests/test_dup_dup.c
@@ -82,7 +82,9 @@ test_dup_key (int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdupdup)
     r = db->set_pagesize(db, 4096); assert(r == 0);
     r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); 
     if (maybe_do_db_dup_warning(r, dup_mode)) {
-        r = db->close(db, 0); assert(r == 0); return;
+        r = db->close(db, 0); assert(r == 0); 
+        r = env->close(env, 0); assert(r == 0);
+        return;
     }
     assert(r == 0);
 
@@ -133,13 +135,17 @@ test_dup_dup (int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdupdup)
     db->set_errfile(db, stderr);
     r = db->set_flags(db, dup_mode);
     if (maybe_do_db_dup_warning(r, dup_mode)) {
-        r = db->close(db, 0); assert(r == 0); return;
+        r = db->close(db, 0); assert(r == 0); 
+        r = env->close(env, 0); assert(r == 0);
+        return;
     }
     assert(r == 0);
     r = db->set_pagesize(db, 4096); assert(r == 0);
     r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); 
     if (maybe_do_db_dup_warning(r, dup_mode)) {
-        r = db->close(db, 0); assert(r == 0); return;
+        r = db->close(db, 0); assert(r == 0); 
+        r = env->close(env, 0); assert(r == 0);
+        return;
     }
     assert(r == 0);
 
@@ -191,6 +197,7 @@ test_put_00_01_01 (int dup_mode, u_int32_t put_flags) {
     r = db->set_flags(db, dup_mode);
     if (maybe_do_db_dup_warning(r, dup_mode)) {
         r = db->close(db, 0); assert(r == 0);
+        r = env->close(env, 0); assert(r == 0);
 	return;
     }
     assert(r == 0);
diff --git a/src/tests/test_dup_flags.c b/src/tests/test_dup_flags.c
index 2e7a37ddbc6435f3ab9e486c0c06a668788384fb..870b230437dd7f0b0b887133d8bdfec6fc250b43 100644
--- a/src/tests/test_dup_flags.c
+++ b/src/tests/test_dup_flags.c
@@ -45,6 +45,7 @@ test_dup_flags (u_int32_t dup_flags) {
 	if (r != 0 && dup_flags == DB_DUP) {
 	    if (verbose) printf("%s:%d: WARNING: tokudb does not support DB_DUP\n", __FILE__, __LINE__);
 	    r = db->close(db, 0); assert(r == 0);
+            r = env->close(env, 0); assert(r == 0);
 	    return;
 	}
     }
diff --git a/src/tests/test_hsoc.c b/src/tests/test_hsoc.c
index d3b7709403df46c634859fc94f7ed6ae8a628220..8d9d2c024f7f481b0ab979597bcbc42791e477ac 100644
--- a/src/tests/test_hsoc.c
+++ b/src/tests/test_hsoc.c
@@ -109,6 +109,7 @@ test_hsoc (int pagesize, int dup_mode) {
     r = cursor->c_close(cursor); assert(r == 0);
 
     r = db->close(db, 0); assert(r == 0);
+    r = env->close(env, 0); assert(r == 0);
 }
 
 int