The last episode of the Bob Newhart show
That was the second one I thought of.
Had to be the funniest and best ending of any show ever.