[ONOS-5794] OFDeviceProvider: always stop collectors

In larger topologies, switchRemoved occasionally triggered
exceptions before it reached the code to stop the collectors,
leaving these collectors trying to talk to devices even if
they were no longer there.

Change so that stopCollectorIfNeeded is always called, as it is
in other OpenFlow provider classes.

Change-Id: I3556a19b5fd15fe73816a785d886a27344df89e4
diff --git a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
index a4098fa..0df2c8c 100644
--- a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -408,11 +408,11 @@
 
         @Override
         public void switchRemoved(Dpid dpid) {
+            stopCollectorIfNeeded(collectors.remove(dpid));
             if (providerService == null) {
                 return;
             }
             providerService.deviceDisconnected(deviceId(uri(dpid)));
-            stopCollectorIfNeeded(collectors.remove(dpid));
         }
 
         @Override