RIO DE JANEIRO (AP) — The Rio Olympics are officially over following a closing ceremony that was a bit more subdued than the opener.

The athletes danced, smiled and took selfies as they entered the stadium and walked around the arena's floor during the flag procession. Simone Biles had the honor of carrying the U.S. flag for the ceremony after winning four gold medals.

Once the Olympic cauldron's flame was extinguished, the stadium turned into a samba-fueled Carnival-like party. Athletes got up from their chairs and danced alongside the costumed performers and a giant float featuring birds.

IOC President Thomas Bach declared the Rio Games over and the Olympic flag was formally handed over to the governor of Tokyo, which will host the 2020 Summer Games.

The ceremony took place on a rainy and windy night in the same venue where Brazil beat Germany on penalty kicks to win a gold medal in men's soccer just one day earlier.

The remaining athletes in Rio gathered hours after the U.S. men's basketball team captured the country's final gold medal in a 96-66 blowout against Serbia. Kevin Durant poured in 30 points for the United States, four years after he scored 30 in the gold medal game at London.

DeMarcus Cousins added 13 points and 15 rebounds as the U.S. team took gold for the third straight Olympics.

Mike Krzyzewski (shuh-SHEF'-skee) is the first coach to lead three gold medal-winning Olympic teams. It was his final game on the bench for the U.S.

Also on the final day of the Rio Games:

— Claressa Shields is the first American boxer to win two gold medals. The 21-year-old Flint, Michigan, native earned a unanimous decision over a Dutch fighter to wrap up back-to-back middleweight gold. Shields ran her Olympics record to 6-0 ans stayed unbeaten since the 2012 London Olympics, winning two world championships and a Pan-American Games title.

— Kyle Snyder won gold in the 97 kilogram class to become the youngest Olympic wrestling champion in U.S. history. The 20-year-old is the second straight American wrestler to win Olympic gold in his weight class, four years after Jake Varner won in London. Snyder beat Varner at the U.S. Olympic team trials in April.

— The U.S. has its first marathon medal since 2004 after Galen Rupp captured the bronze, finishing behind Eliud Kipchoge  of Kenya and Feyisa Lelisa of Ethiopia. The winning time was 2 hours, 8 minutes and 44 seconds.

— The United States men's volleyball team rallied from a two-sets deficit against Russia to capture the bronze medal. The fifth-ranked Americans won 23-25, 21-25, 25-19, 25-19, 15-13. The gold medal match was won by the host country, beating Italy in three sets, 25-22, 28-26, 26-24.

— U.S. Olympic Committee CEO Scott Blackmun says further action is coming in the matter of 12-time swimming medalist Ryan Lochte and his three teammates whose story of a robbery overshadowed the Rio de Janeiro Games. Blackmun offered no details on what disciplinary action may be coming, but he made no effort to hide his frustration with the situation. Blackmun said the swimmers let down other U.S. athletes and the country.

— The United States dominated the overall medal count with 121, finishing first overall in each category. The Americans racked up 46 gold medals, 37 silver and 38 bronze. China collected 70 medals overall, while Britain had 67. The 51-medal margin over runner-up China is the largest in a non-boycotted Olympics in nearly a century.

More From 1460 ESPN