def finalize(self, idx_path: str) -> None:
        """Clean up and write the index (.idx) file

        Args:
            idx_path (str): The path to the index file
        """
        self.data_file.close()
        with _IndexWriter(idx_path, self.dtype) as writer:
            writer.write(self.sequence_lengths, self.sequence_modes, self.document_indices)
Clean up and write the index (.idx) file

        Args:
            idx_path (str): The path to the index file
        
finetune/core/datasets/indexed_dataset.py