LOS ANGELES (AP) — "The Big Bang Theory" closed out its run as television's top-rated comedy with an emotional final episode that saw some big changes for the show's group of geeky misfits.

The long-running series on CBS concluded with two final episodes, "The Change Constant" and "The Stockholm Syndrome," in an hour-long finale Thursday evening. The series exited the TV airwaves with the most episodes for a multi-camera series ever with 279 episodes. It edged past NBC's "Cheers," which aired for 11 seasons and 275 episodes.

"The Big Bang Theory" debuted in 2007 and overcame early doubts to become a cult classic after some questioned the show's chances of survival. The show was led by a crew of nerdy misfits starring Jim Parsons, Kaley Cuoco, Johnny Galecki, Mayim Bialik, Simon Helberg, Kunal Nayyar and Melissa Rauch.

Thursday's finale was followed by a behind-the-scenes look at the show in "Unraveling the Mystery: A Big Bang Farewell" with Galecki and Cuoco as hosts.

The series began about geeky physicist roommates portrayed by Parsons and Galecki and expanded to include their friends, girlfriends and then wives. It inevitably made being nerds and comic book lovers a cool phenomenon in pop culture.

During its tenure, "Big Bang Theory" won 10 Emmy Awards. Parsons took home four of those trophies, including lead actor in a comedy series in 2014.

The final episodes were filled with a few surprises, a pregnancy, cameos and a speech about the importance of friendship in the series' emotional conclusion.

Parson's character Sheldon and Bialik's Amy anxiously awaited the decision on whether the married couple would win the Noble Prize. The final episode also highlighted the fate of the broken elevator, which has been nonfunctional for much of the series.

It included a scene in which Bialik, who is a neuroscientist in real life, urges young girls to pursue careers in science. "Little girls who dream about science" should pursue it as a career and ignore naysayers, she said.

The comedy leaves on a high as one of television's most popular shows. Last week's episode was the most-watched program on broadcast or cable TV with 12.5 million viewers, beating out HBO's "Game of Thrones," which ends its series on Sunday after an eight-year run.

Parsons had said the end of the series feels like a "real rite of passage moment," which was full of memories and some tears. Galecki said the show has touched "so many hearts."

___

Online:

https://www.cbs.com/shows/big_bang_theory

___

Follow AP Entertainment Writer Jonathan Landrum Jr. on Twitter: http://twitter.com/MrLandrum31

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.