def commit(self):
        """Write the database to a file"""
        out = open(self.name,'wb')
        cPickle.dump(self.fields,out,self.protocol)
        cPickle.dump(self.next_id,out,self.protocol)
        cPickle.dump(self.records,out,self.protocol)
        cPickle.dump(self.indices,out,self.protocol)
        out.close()