 
 Error: #{err}"""
 
-    console.log "If you haven't seen any errors, we've probably been successful."
+            if isLast
+                CameraModel.count {}, (err, count) ->
+                    console.log "Saved #{count} cameras successfully."
+                    mongoose.disconnect()
 
 fs.readFile 'data/raw/trafficcameraswithfeed.kml', (err, data) ->
-    parser.parseString data
+    if err then console.log err else parser.parseString data

                x: parseFloat coords[0], 10
                y: parseFloat coords[1], 10

        aCamera.save (err) ->
            if err then console.log """Could not save camera #{i}:



    # Parse each Placemark into a mongoose model and save each
    _(result.Document.Folder.Placemark).each (placemark, i) ->
        # Watch for the last camera since Model.save() is asynchronous and the
        # database connection should be closed after the last successful save.
        if i + 1 is result.Document.Folder.Placemark.length
            isLast = true
        else isLast = false

        url = URL.parse placemark.description.split('"')[3]
        coords = placemark.Point.coordinates.split ','

