Use try-with-resources in testCompactAndRecover