New York City is shuttering schools to try to stop the renewed spread of the coronavirus, Mayor Bill de Blasio said Wednesday in a painful about-face for one of the first big U.S. school systems to bring students back to classrooms this fall.

The nation’s largest public school system will halt in-person learning Thursday, the mayor said in a tweet.

“Please note that this is a temporary closure, and school buildings will reopen as soon as it is safe to do so,” Department of Education Chancellor Richard Carranza said in a letter to parents.

The city had said since summer that school buildings would close if 3% of all the coronavirus tests performed citywide over a seven-day period came back positive. As the rate neared that point last week, de Blasio advised parents to prepare for a possible shutdown within days.

The mayor said the rate now has passed that mark.

The city’s more than 1 million public school students will now be taught entirely online, as most already are. As of the end of October, only about 25% of students had gone to class in school this fall, far fewer than officials had expected.

In-person school resumed Sept. 21 for pre-kindergartners and for some students with special needs. Elementary schools opened Sept. 29 and high schools Oct. 1.

At the time, the seven-day positive test average rate was under 2%.

Even as the school system stayed open, nearly 1,500 classrooms went through temporary closures after students or staffers tested positive, and officials began instituting local shutdowns in neighborhoods where coronavirus cases were rising rapidly.

As of midweek, more than 2,300 students or staff at public schools had tested positive since the start of the school year.

New York City’s school system, like others across the nation, halted in-person learning in mid-March as the virus spiked.