Rail workers win key concessions in deal to prevent strike