The upper chamber passed the measure in an expedited vote to avert a holiday season rail strike.