WASHINGTON — President Trump agreed on Friday to reopen the federal government for three weeks while negotiations continued over how to secure the nation’s southwestern border, backing down after a monthlong standoff failed to force Democrats to give him billions of dollars for his long-promised wall.