Senate approves bill to avoid rail strike