def METHOD_NAME(self, stop_date: Timestamp, cause: Optional[str], error: Optional[str]) -> None:
    with self._state_mutex:
        if isinstance(self._program_state, ProgramRunning):
            self._program_state = ProgramStopped(stop_date=stop_date, cause=cause, error=error)
            for frame in self._frames:
                frame.METHOD_NAME(stop_date=stop_date, cause=cause, error=error)
            self.program_state_event.set()
            self.program_state_event.clear()
        else:
            raise RuntimeError("Cannot stop non running ProgramState.")