[VOL-4699] Fix panic in PM module in openonu-go adapter during Device Delete in Memory leak tests

Change-Id: I1baaa044ff311048d9ee3f6a5e368cdafe7220bc
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index fbf2ea7..6465a0c 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -4548,6 +4548,12 @@
 	}
 	if dh.pOnuMetricsMgr != nil {
 		dh.pOnuMetricsMgr.PrepareForGarbageCollection(ctx, aDeviceID)
+		select {
+		case <-dh.pOnuMetricsMgr.GarbageCollectionComplete:
+			logger.Debugw(ctx, "pm fsm shut down and garbage collection complete", log.Fields{"deviceID": aDeviceID})
+		case <-time.After(pmmgr.MaxTimeForPmFsmShutDown * time.Second):
+			logger.Errorw(ctx, "fsm did not shut down in time", log.Fields{"deviceID": aDeviceID})
+		}
 	}
 	if dh.pAlarmMgr != nil {
 		dh.pAlarmMgr.PrepareForGarbageCollection(ctx, aDeviceID)