fix client app shutdown bug