diff --git a/imbox/__init__.py b/imbox/__init__.py
index <HASH>..<HASH> 100644
--- a/imbox/__init__.py
+++ b/imbox/__init__.py
@@ -13,6 +13,7 @@ class Imbox(object):
 
 
     def logout(self):
+        self.connection.close()
         self.connection.logout()
 
     def query_uids(self, **kwargs):
imbox: call close() before logout

The imaplib documentation recommends calling close() before logout to ensure
that 'deleted messages are removed from writable mailbox.'