Cleans up after the connection to the SMTP server has been closed
        (voluntarily or not).

async def close(self):
        """
        Cleans up after the connection to the SMTP server has been closed
        (voluntarily or not).
        """
        if self.writer is not None:
            # Close the transport:
            try:
                self.writer.close()
            except OSError as exc:
                if exc.errno != errno.ENOTCONN:
                    raise

        self.reset_state()