Allscripts to sell stake in Netsmart for $525M