Wait for compute stats to finish before closing the cursor