title: NSURLSessionDownloadTask not deleting the file when the app is closed by the user and the task was still active
body: <p>I have a <code>NSURLSession</code> and a <code>NSURLSessionDownloadTask</code> configured for downloading a file in background, if the download task in canceled by the user all the data is deleted and the storage space the file was using is freed, but if the app is closed from the multitasking dock the download task is terminated and gives an error but is not deleting the data and the  temporal data for the file is still occupying storage space and is never freed. What do i need to do in order to free the space ?</p>
  
  <p>This is my <code>NSURLSession</code> configuration and error handling:</p>
  
  <pre><code>- (NSURLSession *)backgroundSession {
      static NSURLSession *session = nil;
      static dispatch_once_t onceToken;
      dispatch_once(&amp;onceToken, ^{
  
          NSURLSessionConfiguration *configuration;
          if ([[UIDevice currentDevice].systemVersion hasPrefix:@"7"]) configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:@"com.visyon.pr"];
          else configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"com.visyon.pr"];
          configuration.sessionSendsLaunchEvents =YES;
  
          session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
  
      });
      return session; }
  
  
  - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
  
  
  if (error == nil) {
      NSLog(@"Task: %@ completed successfully", task );
  } else {
     // [self hideActivity];
     // [self showAlertBoxErrorDownload];
      NSLog(@"Task: %@ completed with error: %@, %lu", task, [error localizedDescription], (long)error.code);
  
  }    self.downloadTask = nil; }
  </code></pre>