Cleanup enum and try-with-resources