def teardown(self) -> None:
        """This method is called to close the threads."""
        self._executor.shutdown(wait=True)

        # if an error was raised anytime in any of the `executor.submit` calls
        if self._error:
            raise self._error
This method is called to close the threads.
src/lightning/pytorch/plugins/io/async_plugin.py