Closes the current data file

def close_data(self):
        """Closes the current data file"""
        # save the total number of cells to make re-loading convient
        if self.datafile is not None:
            if self.datafile.filemode != 'r':
                self.datafile.set_metadata('', {'total cells': self.current_cellid})
            self.datafile.close()
            self.datafile = None