concept fact in category groovy

This is an excerpt from Manning's book Groovy in Action, Second Edition.
The fact that you’re reading a production copy of this book means the production process wasn’t stopped and all assertions succeeded. This should give you confidence in the correctness of the Groovy examples provided. For the first edition, we did the same with MS Word using Scriptom (chapter 20) to control MS Word, and AntBuilder (chapter 11) to help with the building side. As we said before, the features of Groovy work best when they’re used together.
How many times have you seen code that opens a stream but calls close at the end of the method, overlooking the fact that the close statement may never be reached when an exception occurs while processing? So, it needs to be protected with a try-catch block. No—wait—that should be try-finally, or should it? And inside the finally block, close can throw another exception that needs to be handled. There are too many details to remember, and so resource handling is often implemented incorrectly. With Groovy’s closure support, you can put that logic in one place and use it like this: