diff --git a/src/lib-sieve-tool/mail-raw.c b/src/lib-sieve-tool/mail-raw.c
index fa6238012d854434e87c0bd3b66993bdbd3ab4df..68ce66bea2f3ba39e7835d247ccd3f8b35b6fe2d 100644
--- a/src/lib-sieve-tool/mail-raw.c
+++ b/src/lib-sieve-tool/mail-raw.c
@@ -291,7 +291,7 @@ void mail_raw_close(struct mail_raw *mailr)
 {
 	mail_free(&mailr->mail);
 	mailbox_transaction_rollback(&mailr->trans);
-	mailbox_close(&mailr->box);
+	mailbox_free(&mailr->box);
 
 	pool_unref(&mailr->pool);
 }
diff --git a/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c b/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
index a1f15d5fa6c200941f070634a2d323cc16a1cf24..b5ddb3f3140a3cb42c1ac7465d972f60f7ded3c5 100644
--- a/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
+++ b/src/lib-sieve/plugins/mailbox/tag-mailbox-create.c
@@ -145,7 +145,7 @@ static bool seff_mailbox_create_pre_execute
     box = mailbox_alloc(trans->namespace->list, trans->folder, NULL, flags);
 	/* Create mailbox */
 	if ( mailbox_create(box, NULL, FALSE) < 0 ) {
-		mailbox_close(&box);
+		mailbox_free(&box);
 		box = NULL;
 
 	} else {
@@ -158,7 +158,7 @@ static bool seff_mailbox_create_pre_execute
 		/* Try opening again */
 		if ( mailbox_sync(box, 0) < 0 ) {
 			/* Failed definitively */
-			mailbox_close(&box);
+			mailbox_free(&box);
 			box = NULL;
 		}
 	} 
diff --git a/src/lib-sieve/plugins/mailbox/tst-mailboxexists.c b/src/lib-sieve/plugins/mailbox/tst-mailboxexists.c
index 4d269760c80632aff34abcdcf5a9ec394ffd1ae9..d262c7d2035ea2358cd73e1f4b414e29e1e36a0a 100644
--- a/src/lib-sieve/plugins/mailbox/tst-mailboxexists.c
+++ b/src/lib-sieve/plugins/mailbox/tst-mailboxexists.c
@@ -155,7 +155,7 @@ static int tst_mailboxexists_operation_execute
 			/* FIXME: check acl for 'p' or 'i' ACL permissions as required by RFC */
 
 			/* Close mailbox */
-			mailbox_close(&box);
+			mailbox_free(&box);
 		}
 	}
 	
diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c
index e73ee9d8aa8001a45581504c073ff6868f5b7e4c..05770f9632225af72c130c040547d5722b7ac89f 100644
--- a/src/lib-sieve/sieve-actions.c
+++ b/src/lib-sieve/sieve-actions.c
@@ -320,14 +320,14 @@ static struct mailbox *act_store_mailbox_open
 	 * create it.
 	 */
 	if ( !aenv->scriptenv->mailbox_autocreate || error != MAIL_ERROR_NOTFOUND ) {
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return NULL;
 	}
 
 	/* Try creating it. */
 	if ( mailbox_create(box, NULL, FALSE) < 0 ) {
 		(void)mail_storage_get_last_error(*storage, &error);
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return NULL;
 	}
 
@@ -339,7 +339,7 @@ static struct mailbox *act_store_mailbox_open
 	/* Try opening again */
 	if ( mailbox_sync(box, 0) < 0 ) {
 		/* Failed definitively */
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return NULL;
 	}
 
@@ -378,7 +378,7 @@ static bool act_store_start
 		 * originates from. In that case we skip actually storing it.
 		 */
 		if ( box != NULL && mailbox_backends_equal(box, msgdata->mail->box) ) {
-			mailbox_close(&box);
+			mailbox_free(&box);
 			box = NULL;
 			ns = NULL;
 			redundant = TRUE;
@@ -613,7 +613,7 @@ static bool act_store_commit
 	
 	/* Close mailbox */	
 	if ( trans->box != NULL )
-		mailbox_close(&trans->box);
+		mailbox_free(&trans->box);
 
 	return status;
 }
@@ -638,7 +638,7 @@ static void act_store_rollback
   
 	/* Close the mailbox */
 	if ( trans->box != NULL )  
-		mailbox_close(&trans->box);
+		mailbox_free(&trans->box);
 }
 
 /*
diff --git a/src/testsuite/testsuite-mailstore.c b/src/testsuite/testsuite-mailstore.c
index b5a6b1064431a57b902d195f2cfbbd9eb280fa8b..5dad4920bef139e291727b00d81781e7edb1037d 100644
--- a/src/testsuite/testsuite-mailstore.c
+++ b/src/testsuite/testsuite-mailstore.c
@@ -123,11 +123,11 @@ bool testsuite_mailstore_mailbox_create
 	box = mailbox_alloc(ns->list, folder, NULL, 0);
 
 	if ( mailbox_create(box, NULL, FALSE) < 0 ) {
-		mailbox_close(&box);
+		mailbox_free(&box);
 		return FALSE;
 	}
 
-	mailbox_close(&box);
+	mailbox_free(&box);
 
 	return TRUE;
 }
@@ -141,7 +141,7 @@ static void testsuite_mailstore_close(void)
 		mailbox_transaction_rollback(&testsuite_mailstore_trans);
 		
 	if ( testsuite_mailstore_box != NULL )
-		mailbox_close(&testsuite_mailstore_box);
+		mailbox_free(&testsuite_mailstore_box);
 
 	if ( testsuite_mailstore_folder != NULL )
 		i_free(testsuite_mailstore_folder);