'Closes all files.  If you put real :class:`file` objects into the
:attr:`files` dict you can call this method to automatically close
them all in one go.'

def close(self):

    if self.closed:
        return
    try:
        files = itervalues(self.files)
    except AttributeError:
        files = ()
    for f in files:
        try:
            f.close()
        except Exception:
            pass
    self.closed = True
