Bake lightprobes in Scenekit programmatically

I am facing issues baking lightprobes on iOS. The same logic bakes lightprobes on macOS successfully. iOS throws the following exception

[MTLDebugCommandBuffer waitUntilCompleted]:201: failed assertion `waitUntilCompleted on uncommitted command buffer'

Some specs : Runtime: iOS 15.4 - DeviceType: iPhone 13 Pro Max. I created two template apps from xcode (one for iOS and the other for macOS). Following is the code for lightprobe bake added in viewDidLoad

SCNScene* scene = [SCNScene scene];

SCNNode *ambientLight = [SCNNode node];
ambientLight.light = [SCNLight light];
ambientLight.light.type = SCNLightTypeAmbient;
ambientLight.light.color = [UIColor whiteColor];
ambientLight.light.intensity = 1000.0;
[scene.rootNode addChildNode:ambientLight];

scene.background.contents = [UIColor whiteColor];
scene.background.intensity = 2000.;

SCNNode *probe1 = [SCNNode node];
probe1.position = SCNVector3Make(-0.493530, 1.7285934, -0.150000);
probe1.light = [SCNLight light];
probe1.light.type = SCNLightTypeProbe;
[scene.rootNode addChildNode:probe1];

SCNRenderer* probeRenderer = [SCNRenderer rendererWithDevice:nil options:nil];
probeRenderer.scene = scene;
NSArray<SCNNode*> *probes = [NSArray arrayWithObjects: probe1, nil];

[probeRenderer updateProbes: probes atTime:1.0];

The crash occurs at updateProbes. Also, I have logged and checked the 27 floats and they are not garbage for macOS so essentially the bake is working as expected on macOS. Any help would be really appreciated!