You seem to be knowledgeable about this. What is the bottom line? Is it fundamentally legal to not release the documents, or are they stretching the law?
Making public has a timing component. The judge is probably ruling no release until after the trial is concluded.
Gag order rulings are done according to judge-made law. Justice is deemed to be served because the parties have all the evidence. Meanwhile, keeping the public in the dark can be justified on many reasons and pretexts. "pre-trial disclosure poses a substantial likelihood of materially prejudicing the fairness of the proceeding."
The Ghislane Maxwell trial is under a gag order too.
Constitutional Gag Orders Restricting Trial Participants' Speech
Other reasons can be given, such as ongoing, unrelated investigations. IMO, most of the time these gag ruling are what you refer to as "stretching the law." Abuse of power and discretion. Self-serving move by the system, to hide the fact that it is perfectly willing and capable of banana-republic justice. Congress pays the bills.