'Flush and close the mailbox.'

def close(self):

    try:
        self.flush()
    finally:
        try:
            if self._locked:
                self.unlock()
        finally:
            self._file.close()
