Im not too deep into USA politics and have very very bad memory so i dont remember how it went down. The Wikipedia article you linked says it was signed by trump.

>and then withheld files.

So did he sign that willingly in the end? Did he have to sign it? Did he cave because he said publicly he would?

A super majority in Congress voted for the files to be the released, which is enough to override a veto, so he had to sign it to save face.