– One of the major concerns before the Pyeongchang Olympics was that the weather would be too cold for anyone to feel comfortable. Even by Minnesota standards, it was frigid, with windchills dropping to the double digits below zero in the small South Korean towns tucked between the mountains and the sea.

The weather, as it turned out, was no match for the hosts. Pyeongchang closed one of the more gracious, efficient and warmhearted Olympics in recent memory Sunday, ending South Korea’s first Winter Games with a joyous celebration of a job well done.

Unlike recent Olympics overshadowed by dirty air and water, unfinished venues, broken budgets and corruption, Pyeongchang ran the world’s largest sporting event in remarkably efficient fashion. An Olympics that began with a hint of a thaw in relations between South and North Korea ended with a promise to continue pursuing diplomacy, as the two nations again marched into Pyeongchang Olympic Stadium together for the Closing Ceremony.

Afton’s Jessie Diggins, who won the first-ever gold medal for the United States in cross-country skiing, was among athletes from 92 nations who paraded their flags one last time before saying goodbye. It seemed fitting that the mountain temperature was higher than it had been in days on a night when thousands of athletes and visitors thanked Pyeongchang for its hospitality.

“Thank you for warming our hearts, even in the coldest temperatures,” said International Olympic Committee President Thomas Bach in his closing speech. “To the gracious hosts, the people of Korea, I say thank you.”

Sunday’s speeches were heavy on references to sports as a means to peace. The fear that North Korea would disrupt the Games was a significant worry until North Korean leader Kim Jong-Un decided at the last minute to send a delegation of 22 athletes, along with cheerleaders, musicians and government officials.

Many South Koreans were skeptical of Kim’s motives, but they were captivated by the spirit of the unified Korean women’s hockey team, which became one of the most popular story lines of the Games. Women in all sports found more opportunity at these Olympics, constituting 41.5 percent of the athletes — the largest proportion ever.

Norway led all nations with 39 medals, a Winter Games record. The last one came Sunday afternoon in the final competition, the women’s cross-country 30-kilometer mass start classic, and it carried special meaning. Marit Bjoergen won by nearly 2 minutes to conclude her fifth and final Olympics with her eighth career gold medal, tying the Olympic record.

On her way into the Alpensia stadium, Bjoergen, 37, swapped one of her ski poles for a large Norwegian flag and waved it to the crowd as she reached the finish line. Bjoergen medaled in all five of her events in Pyeongchang and pushed her career total to 15 medals, the most in Olympic history.

Norway and Germany tied for the most gold medals with 14 each. The U.S. finished fourth in both gold medals (nine) and total medals (23), its smallest medal count at a Winter Games since 1998.

Alan Ashley, chief of sport performance for the U.S. Olympic Committee, said he was not dwelling on the numbers. He noted that American athletes finished between fourth and sixth place 35 times.

“We always want to do better,” Ashley said. “But I’m probably more encouraged than I’ve ever been, even though people say, ‘You didn’t hit your medal count.’ I look at this as an opportunity for us. And the way [the U.S. athletes] represented their country, their families and their communities has been truly fantastic.”

Some familiar problems persisted, with doping at the top of the list. The Russians were forced to continue wearing their scarlet OAR at the ceremony, the acronym for “Olympic Athlete from Russia.”

The country’s Olympic committee and many athletes were banned from the Pyeongchang Games after an investigation uncovered a massive state-sponsored doping scheme. About 170 athletes were allowed to compete after passing drug tests, but they were referred to as OARs and were not allowed to wear their usual uniforms, display their nation’s flag or have their anthem played.

The IOC had left the door open for Russia to march under its flag at the Closing Ceremony, but two positive drug tests during the Games slammed it shut. Curling athlete Alexander Krushelnitsky tested positive for a banned drug and was stripped of the bronze medal he won in mixed doubles. Bobsledder Nadezhda Sergeeva — who recently appeared in a video wearing a T-shirt that read “I Don’t Do Doping” — admitted to taking a banned substance and was disqualified.

The IOC voted Sunday not to lift the ban on the Russian flag and uniforms. The decision angered many Russian fans, who turned out in droves in Pyeongchang with giant flags in their hands and chips on their shoulders. Their country, typically a Winter Olympics power, finished with only two gold medals and 17 overall.

The home team fell short of its target of eight gold medals, but South Korea’s 144 athletes won five gold and 17 overall medals to finish in seventh place in the standings. It also produced some unlikely stars.

The women’s curling team wasn’t expected to challenge for a medal, but the “Garlic Girls” — who come from a town famous for producing garlic — won silver and became a national sensation. Men’s skeleton gold medalist Yun Sung-bin became the first athlete outside of Europe or North America to win an Olympic medal in a sliding sport.

The cold weather was not all bad. For the first time since 2006, the Winter Games felt like winter, and athletes said the good snow made for good performances.

Besides, they knew where to find the warmth, a feeling the Pyeongchang Games’ chief organizer said went both ways.

“Even though it was a short period, Korea was happy because of your warmhearted friendship and passion,” Lee Hee-beom said. “We will never forget you.”