use closing instead of ugly try-finally