Noticed a couple of places that could benefit from try-with-resources.

Comment From: sbrannen

This has been merged into main.

Thanks