A federal appeals court confirmed an earlier ruling on Friday that Actavis must keep Alzheimer’s drug Namenda IR, an older formulation of Namenda XR, on the market.

New York State Attorney General Eric Schneiderman had filed the original lawsuit against the drugmaker saying the company violated antitrust law by forcing patients to switch to a newer and more expensive version of the drug before a generic was on the market.

Actavis had planned to discontinue sales of twice-daily Namenda IR so patients would be forced to switch to the newer formulation, Namenda XR, which can be taken once a day, before the patent ends in October. Generic versions of the drug could become available by July, according to The Wall Street Journal.

The Department of Health and Human Services found in May that pulling Namenda IR from the market completely could cost Medicare and its beneficiaries $6 billion over the next decade.