code: def __exit__(self, exc_type, exc_value, exc_traceback):
      if self._writer is None:
          raise RuntimeError("Unexpected call to __exit__")
  
      self._writer.close()
      if exc_type is not None:
          print("Error while writing file")
          if os.path.exists(self._db_path):
              os.unlink(self._db_path)
      else:
          meta_path = os.path.join(self._path, "meta.bin")
          info: List[FileInfo] = []
          if os.path.exists(meta_path):
              info = _read_info_list(meta_path)
          last_block = 0
          if len(info) > 0:
              last_block = info[-1].block_end
          info.append(
              FileInfo(
                  self._dbname,
                  last_block,
                  last_block + self._writer.nblocks,
                  self._writer.nbytes,
                  self._writer.nlines,
                  False,
                  self._block_size,
              )
          )
  
          # atomic write to meta file
          _write_info_list(meta_path, info)
  
      self._writer = None
  
imports: import io
  import os
  import struct
  from typing import List, Optional, Set
  import torch
  import bisect
  import bmtrain
  import json
  from .serializer import Serializer, PickleSerializer
  import random
  import string
  import time
label_desc: Use image node_id 3 for calling the DatasetBuilder obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, exc_traceback) without return types