Learn more about cloning repositories
You have read-only access
Create one dataset creation property list and one file dataspace and share them across all datasets/iterations. Extract common code into state_destroy().