The online giant is to shut three warehouses, but also plans to open two new ones creating 2,500 roles.