close-connection

When mailbox is a connection to an imap server

This sends a logout command to the
imap server and then closes the socket that's
communicating with the imap server.
mailbox is the object returned by make-imap-connection.

This function does not close the currently selected mailbox
location before logging out, thus messages marked to be deleted in the
currently selected mailbox location will not be removed from
the mailbox. Use close-mailbox or expunge-mailbox before calling
close-connection
to ensure that messages to be deleted are deleted.

When mailbox is a connection to a pop server

This function disconnects from the pop server. All messages marked for
deletion will be deleted.