Use try-with-resources.