The two most extreme examples of this are RIM (now BlackBerry) of the mid-2010s when it was clear the smartphone market was no longer viable for them, and Apple of the 1990s before the return of Steve Jobs and acquisition of NeXT. When asked what he'd do with Apple in 1997, Michael Dell famously said "I'd shut it down and give the money back to the shareholders."
But both companies are still alive today (Apple more than BlackBerry) because they were large enough before they had to pivot.
Other big tech companies like Microsoft were never close to death at any time. Sure, they had periods of stagnation where they had to pivot (as mentioned in this blog post), but it was more like a cold than a life threatening illness.