After $28 million ruling, Somerville will scrap plans for public safety building and sell land