imageOs.flush();
imageOs.close();
LOG.info("Succefully created the image file: " + tPath);
ufs.delete(path, false);
ufs.rename(tPath, path);
ufs.delete(tPath, false);
LOG.info("Renamed " + tPath + " to " + path);
// safe to close, nothing created here with scope outside function
ufs.close();
}