Fixed thread safety in IMAP async connection