Fix lifetime issue and shutdown issue

If bmcweb isn't running, the existing code stalls because io.stop() is
never called.  Fix that, as well as make loglevel capture by value in
the lambda.

Tested: Inspection only.

Change-Id: I61c5ea323d58b984c5b7356a6f2637d2a953a0b1
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/src/webserver_cli.cpp b/src/webserver_cli.cpp
index a4ad819..521a250 100644
--- a/src/webserver_cli.cpp
+++ b/src/webserver_cli.cpp
@@ -102,13 +102,15 @@
 
     // Attempt to async_call to set logging level
     conn->async_method_call(
-        [&io, &loglevel](boost::system::error_code& ec) mutable {
+        [&io, loglevel](boost::system::error_code& ec) mutable {
             if (ec)
             {
                 BMCWEB_LOG_ERROR("SetLogLevel returned error with {}", ec);
-                return;
             }
-            BMCWEB_LOG_INFO("logging level changed to: {}", loglevel);
+            else
+            {
+                BMCWEB_LOG_INFO("logging level changed to: {}", loglevel);
+            }
             io.stop();
         },
         service, path, iface, method, loglevel);