Borders is officially liquidated. Now all that remains is closing stores, and trying to work out a deal with Books-A-Million to keep as many as 35 of the book selling chain's store open.

Borders won bankruptcy court approval to liquidate Thursday afternoon, signaling the end for America's second largest bookstore chain. Borders has 399 stores and 10,700 employees. A last-minute offer from Books-A-Million may save 1,000 to 1,500 jobs and keep 30 to 35 stores open.

Calling it a "bittersweet day," U.S. Bankruptcy Judge Martin Glenn announced today before a packed courtroom during proceedings involving Borders' liquidation some stores may be spared through a sale to Books-a-Million.

Glenn said a last-minute offer from Books-a-Million may save 30 Borders stores and as many as 1,000 to 1,500 jobs.

Borders was still planning to proceed Thursday in seeking court approval to liquidate, closing most of its 399 stores.

"This is a bittersweet day," said Judge Glenn. "There are a lot of sad people around the country, a lot of sad people in the corporate headquarters. But there has been a late-breaking development."

Based in Birmingham, Alabama with more than 200 stores in the Southeast, Books-a-Million has made an offer to buy 21 Borders superstores and nine smaller stores. Seven of the 30 stores in located in Pennsylvania. The superstore locations include Atlantic City, N.J., and Waterford, Conn.

Under the deal, Books-A-Million would get inventory and merchandise at the stores and negotiate new leases with the landlords.

A group of liquidators including Hilco Merchant Resources and Gordon Brothers Retail Partners will sell off Borders' merchandise and furnishing, beginning as early as Friday.

Borders will keep its brand name and leases and sell off those assets through an auction process.

Based in Ann Arbor, Mich., Borders filed for bankruptcy in February. The nation's second-largest bookstore tried to find a buyer to keep all or some of its 399 stores open but a deal never materialized, and the company decided to liquidate. Borders began negotiating with Books-a-Million last week, in the effort to keep some stores open, but a deal wasn't reached.

Books-a-Million is a publicly traded company. Its stock (BAMM) rose three percent on the news to $3.05 in trading Thursday.