client: graceful shutdown improvement