“The Newsroom” came to a close Sunday on HBO, and even after three seasons, this Aaron Sorkin series is still puzzling. It was a paean to journalism that many journalists hated, an inside look at the immediacy of a 24-hour cable news division that was set two years in the past. Oddest of all, it was a 1940s-style screwball comedy about reporters filled with sanctimony, not cynicism: a “His Girl Friday” by Allen Drury.

So much of “The Newsroom” was great, and so much of it wasn’t.

Both qualities were on full display in Sunday night’s finale, a valedictory episode that tied up loose ends and let almost everyone — except Charlie (Sam Waterston), who died on the job — live happily ever after. There were mawkishly sentimental moments, like the spontaneous jam session at Charlie’s funeral, and also cloyingly cute ones about Will McAvoy (Jeff Daniels) turning medieval when he finds out that his bride, MacKenzie McHale (Emily Mortimer) is pregnant.

The episode was more engaging when it focused on work and the search for Charlie’s successor. The network’s former owner, Leona (Jane Fonda), persuaded the new one, a bullying tech billionaire named Lucas (B. J. Novak), to promote MacKenzie to defuse a damaging media to-do over his treatment of women (pay inequity, hookers hired for a birthday party and a soft drink for millennials called Kwench).

Lucas told Leona that he had the most expensive public relations people in New York working on improving his feminist credentials. Leona told him there was something he needed to understand: “You have a P.R. problem because you have an actual problem.”