Bugfix in REST call and client connection close handling