Use `try finally` to auto close streams