diff --git a/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java b/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java index e3887b2ee..f65750d8a 100644 --- a/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java +++ b/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java @@ -93,7 +93,7 @@ public class LazyFileOutputStream extends OutputStream { } public synchronized void close() throws IOException { - if (alwaysCreate) { + if (alwaysCreate && !closed) { ensureOpened(); } if (opened) {