UK retailer Marks & Spencer (M&S) is to close two of its clothing and homewares distribution centres, putting some 662 jobs at risk, as it moves to a nationally connected distribution network.