regulators: Close devices when system powering off

Modify the Manager class to close all regulator devices when monitoring
is disabled.  Monitoring is normally disabled because the system is
being powered off.

Also add a closeDevices() method to the System class that closes all
devices in the system.

Tested:
  * Tested when monitoring was disabled.  Verified debug journal message
    stating devices were closed.
  * Tested multiple consecutive power on/off cycles to ensure device
    access remained functional.
  * Performed regression test on existing function.
  * Created and executed automated tests for System::closeDevices()

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I074190454c505116cccf1bc130a70205f34d0e26
diff --git a/phosphor-regulators/src/manager.cpp b/phosphor-regulators/src/manager.cpp
index cbcdec4..10b9de9 100644
--- a/phosphor-regulators/src/manager.cpp
+++ b/phosphor-regulators/src/manager.cpp
@@ -99,22 +99,34 @@
     // fail the call(busctl) to this method
 }
 
-void Manager::monitor(bool /*enable*/)
+void Manager::monitor(bool enable)
 {
-    /* Temporarily comment out until monitoring is supported.
     if (enable)
     {
-        Timer timer(eventLoop, std::bind(&Manager::timerExpired, this));
-        // Set timer as a repeating 1sec timer
-        timer.restart(std::chrono::milliseconds(1000));
-        timers.emplace_back(std::move(timer));
+        /* Temporarily comment out until monitoring is supported.
+            Timer timer(eventLoop, std::bind(&Manager::timerExpired, this));
+            // Set timer as a repeating 1sec timer
+            timer.restart(std::chrono::milliseconds(1000));
+            timers.emplace_back(std::move(timer));
+        */
     }
     else
     {
-        // Delete all timers to disable monitoring
-        timers.clear();
+        /* Temporarily comment out until monitoring is supported.
+            // Delete all timers to disable monitoring
+            timers.clear();
+        */
+
+        // Verify System object exists; this means config file has been loaded
+        if (system)
+        {
+            // Close the regulator devices in the system.  Monitoring is
+            // normally disabled because the system is being powered off.  The
+            // devices should be closed in case hardware is removed or replaced
+            // while the system is at standby.
+            system->closeDevices();
+        }
     }
-    */
 }
 
 void Manager::timerExpired()