public static function shutdownHook(array $files) {
    foreach ($files as $file) {
      // Break and allow a response if the timeout has been reached.
      if ((connection_status() & CONNECTION_TIMEOUT) == CONNECTION_TIMEOUT) {
        break;
      }
      if (isset($file['tmp_name'])) {
        if (is_array($file['tmp_name'])) {
          foreach($file['tmp_name'] as $name) {
            self::checkAndUnlinkFile($name);
          }
        } else {
          self::checkAndUnlinkFile($file['tmp_name']);
        }
      }
    }
  }