Fix a memory leak if the IMAP connection does not open.