Agent shutdown handled and tested