Loading map from pak file, async loading code error

I succesfully load the map from a pak file in the Editor, but failed to load it after packaging and in runtime execution. I read the log and found:

LogUObjectHash: Compacting FUObjectHashTables data took   0.62ms
LogStreaming: Error: Couldn't find file for package /Game/Pak2/NewWorld requested by async loading code. NameToLoad: /Game/Pak2/NewWorld
LogStreaming: Error: This will hitch streaming because it ends up searching the disk instead of finding the file in the pak file.
LogStreaming: Error: Found 0 dependent packages...

But the same code works in PIE:

LogUObjectHash: Compacting FUObjectHashTables data took   0.78ms
LogPlayLevel: Creating play world package: /Game/Pak2/UEDPIE_0_NewWorld
LogPlayLevel: PIE: StaticDuplicateObject took: (0.000491s)
LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/Pak2/NewWorld.NewWorld to /Game/Pak2/UEDPIE_0_NewWorld.NewWorld (0.000519s)

I can tell that there is a difference in the mechanism between PIE and runtime mode, but how can I fix it? BTW when I load a widget asset, it works both in PIE and runtime mode.

Here is my code:
TSharedPtr pakPlatformFile = MakeShareable(new FPakPlatformFile());
pakPlatformFile->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT(“”));
IPlatformFile& oldPlatformFile = FPlatformFileManager::Get().GetPlatformFile();
FPlatformFileManager::Get().SetPlatformFile(*pakPlatformFile);

if (WITH_EDITOR)
{
    pakPlatformFile->Mount(TEXT("D:/code_work/pakLoad2/Content/Paks/pakchunk2-Windows.pak"), 1, TEXT("D:/code_work/pakLoad2/Content/Pak2/"));
    GAllowUnversionedContentInEditor = true;
}

else
{
    pakPlatformFile->Mount(TEXT("D:/code_work/pakLoad2/Content/Paks/pakchunk2-Windows.pak"), 1, TEXT("../../../Content/Pak2/"));
    FPlatformFileManager::Get().InitializeNewAsyncIO();
}

FString worldPath = TEXT("World'/Game/Pak2/NewWorld.NewWorld'");
UWorld* LoadedWorld = LoadObject<UWorld>(nullptr, *worldPath);
if (LoadedWorld)
{
    FString LevelName = LoadedWorld->GetName();
    SwitchLevel(GetWorld(), FName(*LevelName));
}
else
{
    UE_LOG(LogTemp, Error, TEXT("Failed to load world."));
}
FPlatformFileManager::Get().SetPlatformFile(oldPlatformFile);

//FString objectPath = TEXT("UserWidget'/Game/Pak2/NeedHotUpdatedUI.NeedHotUpdatedUI_C'");
//UClass* widgetClass = LoadClass<UUserWidget>(nullptr, *objectPath);
//if (widgetClass)
//{
//    UUserWidget* widget = UWidgetBlueprintLibrary::Create(GWorld, widgetClass, nullptr);

//    widget->AddToViewport();
//}
//else
//{
//    UE_LOG(LogTemp, Error, TEXT("UClass* widgetClass = LoadClass<UUserWidget>(nullptr, *objectPath);"))
//}
//FPlatformFileManager::Get().SetPlatformFile(oldPlatformFile);