class_docstr: If you wish to write a custom profiler, you should inherit from this class.
docstr: Execute arbitrary post-profiling tear-down steps.
  
  Closes the currently open file and stream.
docstr_tok: ["Execute","arbitrary","post-profiling","tear-down","steps",".","Closes","the","currently","open","file","and","stream","."]
code: def teardown(self, stage: Optional[str]) -> None:
      """Execute arbitrary post-profiling tear-down steps.
  
      Closes the currently open file and stream.
  
      """
      self._write_stream = None
      if self._output_file is not None:
          self._output_file.close()
          self._output_file = None
  
imports: import logging
  import os
  from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from pathlib import Path
  from typing import Any, Callable, Dict, Generator, Optional, TextIO, Union
  from lightning.fabric.utilities.cloud_io import get_filesystem
label_desc: Use image node_id 12 for calling the Profiler obj's underlying member method code with example usage: obj.teardown(stage) without return types