Reconnect to IMAP server if it closed.
Also, remove some commented-out code.