Scottish government loses indyref2 court case