Japan scare Scotland but run out of steam at Murrayfield