Inserts a statement in a try-with-resources block (Java 7 or higher is required).