def close(self, timeout: float = 5.0) -> None:
        """Clean shutdown of the log streaming."""
        self._stop_event.set()
        if self.stdout_thread and self.stdout_thread.is_alive():
            self.stdout_thread.join(timeout)
        # Close the log generator to release the file descriptor
        if self.log_generator is not None:
            self.log_generator.close()
Clean shutdown of the log streaming.
openhands/runtime/utils/log_streamer.py