A judge on Wednesday ordered the release of documents relating to hush-money payments by Donald Trump's former personal lawyer Michael Cohen to two women who said they had sexual encounters with the president and disclosed that federal prosecutors had ended their investigation of the matter.