Nestle plans to close a factory in Shanghai as it looks to refocus its ice cream business in China.