Junior doctors edge closer to deal on working hours