[VOL-5413]reconcile-cleanupmiss

Change-Id: Ib3c091e2088fde13dd9accc00fb75d05793c4df5
Signed-off-by: Nandita Biradar <nbirada@radisys.com>
diff --git a/VERSION b/VERSION
index 0f44168..d15b8b0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.4
+3.6.5
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 92a7e1c..22ec799 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -1527,6 +1527,12 @@
 	// up when the loop breaks
 	var backoffTimer *time.Timer
 	isDeviceReconciledErr := false
+	defer func() {
+		err := agent.reconcilingCleanup(ctx)
+		if err != nil {
+			logger.Errorf(ctx, "Error during reconcile cleanup", err.Error())
+		}
+	}()
 
 retry:
 	for {
@@ -1551,10 +1557,6 @@
 					"device-id": device.Id})
 				// Release lock before reconcile clean up
 				agent.requestQueue.RequestComplete()
-				err := agent.reconcilingCleanup(ctx)
-				if err != nil {
-					logger.Errorf(ctx, "Error during reconcile cleanup", err.Error())
-				}
 				break retry
 			}
 			// If we reach a maximum then warn and reset the backoff