After months of delays and intense negotiations, the U.S. Congress approved an agreement with railway unions to avoid a shutdown.