add try finally block to future-proof code from possible interrupt exceptions.