Palantir shares closed higher as the intelligence company announced a deal with Microsoft to sell AI services to the US intelligence community.