VOL-3195: rw-core panic during group deletion

- read the group before it is deleted from map

Change-Id: I249df95358fb67058d2a6e07a44da7df6389a5f4
diff --git a/rw_core/core/device/logical_agent_group.go b/rw_core/core/device/logical_agent_group.go
index e126fdc..bf2edbb 100644
--- a/rw_core/core/device/logical_agent_group.go
+++ b/rw_core/core/device/logical_agent_group.go
@@ -115,10 +115,10 @@
 
 	for groupID := range toDelete {
 		if groupHandle, have := agent.groupLoader.Lock(groupID); have {
+			affectedGroups[groupID] = groupHandle.GetReadOnly()
 			if err := groupHandle.Delete(ctx); err != nil {
 				return err
 			}
-			affectedGroups[groupID] = groupHandle.GetReadOnly()
 			groupHandle.Unlock()
 
 			//TODO: this is another case where ordering guarantees are not being made,