US rail companies, unions reach ‘tentative’ deal to avert strike