The agreement would end a years-long legal dispute over control of Union Station between Amtrak and a real estate company.