diff --git a/core/src/main/java/io/undertow/channels/FixedLengthStreamSinkChannel.java b/core/src/main/java/io/undertow/channels/FixedLengthStreamSinkChannel.java
index <HASH>..<HASH> 100644
--- a/core/src/main/java/io/undertow/channels/FixedLengthStreamSinkChannel.java
+++ b/core/src/main/java/io/undertow/channels/FixedLengthStreamSinkChannel.java
@@ -341,9 +341,7 @@ public final class FixedLengthStreamSinkChannel implements StreamSinkChannel, Pr
     private void exitWrite(long oldVal, long consumed) {
         long newVal = oldVal - consumed;
         state = newVal;
-        if (allAreSet(newVal, FLAG_CLOSE_COMPLETE)) {
-            // closed while we were in flight.  Call the listener.
-            callClosed();
+        if (anyAreSet(oldVal, MASK_COUNT) && allAreClear(newVal, MASK_COUNT)) {
             callFinish();
         }
     }
Fix bug in FixedLengthStreamSinkChannel that was breaking persistent connections