liboverlay: Invoke commit before freeing the writeback device

MDP releases resources programmed for the WB device only when the
device is not used by anyone else. So freeing up the WB device from
HWC doesn't always guarantee that all the pipes staged on the
device will be freed up. Always invoke the commit explicitly
before releasing WB device to unstage the resources.

Change-Id: I1d98b489eda3baf12449f84edfb3b3f8b84158d9
diff --git a/liboverlay/overlayWriteback.cpp b/liboverlay/overlayWriteback.cpp
index 08af00f..de18e55 100644
--- a/liboverlay/overlayWriteback.cpp
+++ b/liboverlay/overlayWriteback.cpp
@@ -101,8 +101,12 @@
 
 bool Writeback::stopSession() {
     if(mFd.valid()) {
+        if(!Overlay::displayCommit(mFd.getFD())) {
+            ALOGE("%s: displayCommit failed", __func__);
+            return false;
+        }
         if(!mdp_wrapper::wbStopTerminate(mFd.getFD())) {
-            ALOGE("%s failed", __func__);
+            ALOGE("%s: wbStopTerminate failed", __func__);
             return false;
         }
     } else {