How to gracefully shutdown network devices