try with resources, clean up FAILED dirs