Senate votes to approve legislation aimed at avoiding a rail strike