Merge "Use try-with-resources to ensure the cursor is closed" into sc-mainline-prod