added auto-shutdown for Client