NSW government and rail union working on deal to end strikes