If preferred we can use guava Closables here, but in any case this is an improvement