finalize mod_imap