             if loadedEtag == etag { return }
         }
 
-        func onResponse(headers: HTTPHeaders, json: AnyObject?) {
+        func removeConnection() {
             if !solo {
                 removeConnectionForLoadingGroup(
                     group: IMSLoadingGroup.Incidents,
                     id: IMSConnectionID.Incidents(number)
                 )
             }
+        }
+            
+        func onResponse(headers: HTTPHeaders, json: AnyObject?) {
+            defer { removeConnection() }
 
             let incident: Incident
             do { incident = try readIncident(json: json, expectedNumber: number) }

    private func loadIncidentTypes() {
        let typesURL = "\(self.url)incident_types/"

        func onResponse(headers: HTTPHeaders, json: AnyObject?) {
            removeConnectionForLoadingGroup(
                group: IMSLoadingGroup.IncidentTypes,
                id: IMSConnectionID.IncidentTypes
            )

            guard let json = json else {
                logError("Incident types request retrieved no JSON data")

    private func loadLocations() {
        let locationsURL = "\(self.url)locations/"

        func removeConnection() {
            removeConnectionForLoadingGroup(
                group: IMSLoadingGroup.Locations,
                id: IMSConnectionID.Locations
            )
        }
        
        func onResponse(headers: HTTPHeaders, json: AnyObject?) {
            defer { removeConnection() }
            
            guard let json = json else {
                logError("Locations request retrieved no JSON data")
                return
