shutdown agents before exiting