A 33-year-old American woman running out of her life-saving medication to treat her auto-immune disease finally boarded a flight home Wednesday after being stuck in Peru for about 10 days, but hundreds of other U.S. citizens remained stranded after the South American nation closed its borders due to the coronavirus pandemic.

"I could not be happier," Anna, who requested that her last name not be made public due to privacy concerns related to her medical condition, said after getting on the plane in Cusco.

At the same time, it was bittersweet. On the way to the airport, Anna and her husband saw a long line of Americans hoping to get on the flight. Her husband told The Associated Press that some people have been "sitting outside the airport for a week."

Get Breaking News Delivered to Your Inbox

"So obviously not everyone on line was getting on this flight," he said, adding that there were 167 passengers on the LATAM plane, which was organized by the U.S. State Department and allowed to land by Peruvian authorities, unlike previous planes.

The flight from Cusco to Miami with a stop in the Peruvian capital of Lima was the culmination of more than a week of desperately trying to get out of South American nation. The couple had tried to charter a plane to leave Cusco, nestled high in the Andes near the ancient ruins of Machu Picchu, but the Peruvian government refused to give it permission to land. And when they asked the State Department for help, they said they were told the agency was working on the situation.

"There are other foreign governments that are able to take out their citizens, but it seems that with the U.S. there is some gridlock in the Peruvian government granting those airplanes permission to land," Anna said Tuesday. "But there are many citizens here that are just desperate to go home."

Thousands of U.S. citizens have found themselves trapped abroad because of the pandemic. Anna and her husband, like many others, said they had a hard time getting help or information.

Ian Brownlee, head of the U.S. State Department's task force on repatriations, said Wednesday that State and the U.S. Embassy in Peru had secured the needed permissions from the Foreign Ministry for the flight Tuesday to land, but that agreement apparently did not "trickle down to the appropriate people" who run the airport.

Brownlee said the situation was chaotic but it appeared to have been resolved and that two flights - one from Lima and one from Cusco - left Wednesday. More flights are expected to depart this week, he told reporters in a conference call. Brownlee said there were about 4,000 Americans still in Peru and another large number in nearby Ecuador.

Peruvian President Martín Vizcarra, a soft-spoken U.S. ally, was among the first in Latin America to close borders over the coronavirus pandemic, deploy the military and require people to stay in their homes. Initially he allowed waivers for chartered repatriation flights, but that ended Saturday.

The pandemic has infected more than 400,000 people around the world and killed over 20,000. The COVID-19 illness causes mild or moderate symptoms in most people, but severe, life-threatening symptoms are possible especially for the elderly or those with existing health problems - like Anna.

Peru confirmed its first case of the virus March 6, three days before she arrived to meet her husband who was there as part of a South American trip. When Vizcarra declared an emergency and closed the borders March 15, they were given just 24 hours to leave.

Anna's husband immediately turned to the U.S. Embassy for help, telling officials about her precarious health condition and dwindling supply of medication. He provided a note from her U.S. doctor attesting that it was "very urgent and important that she returns to USA" for treatment.

Then he contacted political leaders in Texas including Sens. Ted Cruz and John Cornyn, who he said tried to help. The couple believed an American plane would arrive Tuesday, but that didn't happen.

Another flight was also turned away that day. American Airlines spokesman Ross Feinstein said a charter flight from Miami reached Peruvian airspace that afternoon but was denied permission to land, and circled until fuel levels dictated a return to Florida. The State Department said Peru also did not provide clearances for a LATAM flight to pick up Americans in Cusco.

Various private air charter companies had been working feverishly to find a way to bring them home, according to communications that Anna showed to the AP.

Steve Panzella, president of Horizon Jets Charter Inc., said Tuesday that the couple contacted him about an air ambulance and said they were willing to pay to bring other Americans home on any flight they chartered, but the holdup was securing permission from Peru.

"I have been getting calls 24 hours a day from people stuck all over Central and South America, but nothing like Peru," Panzella said. "People are desperate."

In interviews, other Americans who traveled to Peru painted a bleak picture of armed troops patrolling the streets during the lockdown and making sure they stay in their hotels. Some told the AP they didn't know how or when they would get home. Others managed to leave by buying tickets through local travel companies. But they were given little advance notice about the flights and didn't know until they boarded if there would be enough seats.

To help Peruvian aviation authorities, Brownlee said the State Department's Bureau of International Narcotics and Law Enforcement had vacated a hanger on the military side of Lima's airport so it could serve as a waiting and staging area for passengers waiting to leave.

"We're doing what we can to help the Peruvians," he said.

For Anna, at least, the ordeal is over.

She's looking forward to having access to her medications. And after more than a week confined to a hotel, she was looking forward to something else: "Walking around the green grass of our backyard."