close file in try/finally block