Starbucks will close about 400 U.S. locations, mainly in big cities, citing competition and higher costs as reasons.