                                 completion(url)
                             }
                         }
+                        task = nil
                     } else {
                         task!.cancel()
                         task = nil

                            completion(url)
                        }
                    }
                }
            }
        }) 

                        onError(PreviewError.cannotBeOpened(url.absoluteString))
                    }
                }
                task = nil
            } else {
                if let finalResult = response?.url {
                    if (finalResult.absoluteString == url.absoluteString) {
