Wrapped a few leaky streams in try-with-resources constructs.