Emily Deschanel and ‘Bones’ boss break down the final episode

The End in the End" series finale episode of "Bones."

WARNING: This story contains spoilers about the “Bones” series finale.

It was around 5 a.m. on a day back in December when Emily Deschanel closed the door on a 12-year chapter in her life and finally hung up her lab coat as Dr. Temperance Brennan on Fox’s “Bones.”

The previous night was a lot more than a typical day in the lab, however.

The cast and crew of “Bones” were on location filming the climax of their series finale episode — an intense scene where Brennan and Booth (David Boreanaz) take on vengeful killer Mark Kovac (Gerard Celasco).

Boreanaz was at the helm, serving as director on the action-filled night, full of shoot outs, running, falling, and, eventually, a lot of tears.

Deschanel had planned to come back the next night for a few more scenes, but a half hour before they were set to depart set, Boreanaz told her that he could get everything he needed that evening.

“It was a little bit of a shock,” Deschanel said. “It was emotional. I burst into tears and choked up and said goodbye to people. It was really strange — and then it took two hours to drive home.”

How to say goodbye

It was a bit of a long goodbye for “Bones.”

Fox announced in February 2016 that the show was renewed for what would be a 12th and final season — “a good run,” Deschanel calls it.

The show’s final episode aired Tuesday.

Showrunners had time to plan one final arc and a proper farewell for loyal fans, who’d followed the show to 23 different time slots over the years.

Executive producer Jonathan Collier, who’s been with the show for six seasons, wanted to bring character stories full circle with something impactful. So he and fellow showrunner Michael Peterson looked to the past to find the show’s future.

In a Season 1 episode written by longtime executive producer Stephen Nathan they found their answer — a storyline that recalled Booth’s time as a sniper and a particular instance where he killed a boy’s warlord father during his son’s birthday party.

“We thought this would be a great way to show an emotional journey for Booth for the show,” Collier told CNN. “He finds healing and redemption.”

Kovac was killed in the series finale.

“[Booth] reached a place with Brennan where he’s no longer in pain,” Collier said of the finale. “Or he at least has the tools to deal with his pain.”

For Brennan, the episode contained another twist. Following a lab explosion in the penultimate episode, she lost the scientific, crime-solving abilities for which she’s become famous. Doing this allowed the writers to show how much she’s grown, Collier said.

Though the character identified herself purely by her abilities in the early seasons, the last 12 years have proven to Brennan that she’s so much more than that.

“She defines herself by her abilities, by this enormous ability she has and this brilliance and this capability, and what happens when you strip that away?” he said. “Maybe something even more important remains….We wanted to have that emotional wholeness at the end.”

Deschanel was fascinated by the concept and encouraged the writers to explore the idea to its deepest depths.

The finale has an especially emotional scene where Booth and Brennan share a sweet conversation in the office about how much Brennan — with her abilities or not — means to Booth.

“I thought they did a great job coming up with a story that really kind of wraps up a lot of storylines and characters,” she said. “It’s dramatic but also satisfying in many ways. I thought they did an amazing job.”

Is this REALLY the end?

The finale also set up all of the show’s favorites for the future.

Camille (Tamara Taylor) and Arastoo (Pej Vahdat) adopted three children. She took a six month leave to help her children settle in.

In her absence, Hodgins (T. J. Thyne) was appointed temporary director — or “king of the lab,” one of the show’s running jokes.

Aubrey (John Boyd) got a promotion that would keep him in D.C. instead of moving across the country. And Angela (Michaela Conlin) wrote a children’s book.

The writers solved a long-time mystery, as well — the meaning of “447,” a number that has popped up repeatedly on the series and has been the subject of fan speculation.

In the closing scene of the final episode, a scene between Brennan and Booth reveals the number is essentially a metaphor for perseverance.

“Oh, that was [decided] up until the end,” Collier said, laughing. “We were trying to figure it out. We all had different ideas for what it should be. All of us weighed in and it was going on for a long time.”

The goal was to leave viewers with a sense of peace and hopefulness, Collier said.

“The characters are okay; they’re well and good,” he said. “The big thing, too, is I really hope it’s a positive message that adversity can be overcome. Everyone has problems in their lives. These people have a problem every week, and a huge problem at the end. But they’re together and they overcome it.”

But is this really the end for “Bones?”

The cast and producers have been open about the fact that the decision to end the show was prompted by the network — but there’s no hard feelings. And no reason to close the door on a possible return of some kind in the future, said Deschanel.

“I would not rule it out,” she said.