diff --git a/src/main/java/com/aws/greengrass/config/ConfigurationWriter.java b/src/main/java/com/aws/greengrass/config/ConfigurationWriter.java index 901305df4e..a730afd95c 100644 --- a/src/main/java/com/aws/greengrass/config/ConfigurationWriter.java +++ b/src/main/java/com/aws/greengrass/config/ConfigurationWriter.java @@ -207,9 +207,11 @@ private synchronized void truncateTlog() { if (out instanceof Commitable) { ((Commitable) out).commit(); } - logger.atDebug(TRUNCATE_TLOG_EVENT).log("existing tlog writer closed"); + // move old tlog try { + out.close(); + logger.atDebug(TRUNCATE_TLOG_EVENT).log("existing tlog writer closed"); Files.move(tlogOutputPath, oldTlogPath, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { logger.atError(TRUNCATE_TLOG_EVENT, e).log("failed to rename existing tlog");