moved IOUtils.closeQuietly() to finally blocks