Deal reached to avoid SkyTrain shutdown