Fix "indexOf" JS error when upload is closed without uploading.