added explicit shutdown of devices when the gateway closes.