run completion block on the main thread

If there was an network error we should always run the completion block
on the main thread. The shared session of NSURLSession does not use the
main queue as the delegate queue to run the completion handler.