   done: (error) ->
     @error error if error
 
-    if @nodeInstance.isOrdered() and @nodeInstance.bracketContext[@scope]?.length and @nodeInstance.load is 1
+    isLast = =>
+      pos = @nodeInstance.outputQ.indexOf @result
+      len = @nodeInstance.outputQ.length
+      load = @nodeInstance.load
+      return true if pos is len - 1
+      return true if pos is -1 and load is len + 1
+      return true if len <= 1 and load is 1
+      false
+
+    if @nodeInstance.isOrdered() and isLast()
       # We're doing bracket forwarding. See if there are
-      # dangling closeBrackets in buffer
-      nodeContext = @nodeInstance.bracketContext[@scope]
-      processContext = @result.__bracketContext
-      context = nodeContext[nodeContext.length - 1]
-      buf = @nodeInstance.inPorts[context.source].getBuffer context.ip.scope
-      loop
-        break unless buf.length
-        break unless buf[0].type is 'closeBracket'
-        ip = @nodeInstance.inPorts[context.source].get context.ip.scope
-        ctx = @nodeInstance.bracketContext[ip.scope].pop()
-        ctx.closeIp = ip
-        @result.__bracketClosingAfter = [] unless @result.__bracketClosingAfter
-        @result.__bracketClosingAfter.push ctx
+      # dangling closeBrackets in buffer since we're the
+      # last running process function.
+      for port, contexts of @nodeInstance.bracketContext
+        continue unless contexts[@scope]
+        continue if @nodeInstance.outputQ.length > 1
+        debug "#{@nodeInstance.nodeId} potential closeBracket-B for #{port}"
+        nodeContext = contexts[@scope]
+        context = nodeContext[nodeContext.length - 1]
+        buf = @nodeInstance.inPorts[context.source].getBuffer context.ip.scope
+        loop
+          break unless buf.length
+          break unless buf[0].type is 'closeBracket'
+          ip = @nodeInstance.inPorts[context.source].get context.ip.scope
+          ctx = nodeContext.pop()
+          ctx.closeIp = ip
+          @result.__bracketClosingAfter = [] unless @result.__bracketClosingAfter
+          @result.__bracketClosingAfter.push ctx
 
     debug "#{@nodeInstance.nodeId} finished processing #{@nodeInstance.load}"
     @nodeInstance.load--

          result[port] = [] unless result[port]
          result[port].unshift context.closeIp.clone()

    if result.__bracketContext?.length
      # First see if there are any brackets to forward
      for outport, ips of result
        continue if outport.indexOf('__') is 0
        unforwarded = result.__bracketContext.filter (ctx) =>
          return false unless @isForwardingOutport ctx.source, outport
          ctx.ports.indexOf(outport) is -1
        continue unless unforwarded.length
        unforwarded.reverse()
        for ctx in unforwarded
          ips.unshift ctx.ip.clone()
          ctx.ports.push outport

    if result.__bracketClosingAfter?.length
      for context in result.__bracketClosingAfter


  __getForForwarding: (port) ->
    # Ensure we have a bracket context for the current scope
    @nodeInstance.bracketContext[port] = {} unless @nodeInstance.bracketContext[port]
    @nodeInstance.bracketContext[port][@scope] = [] unless @nodeInstance.bracketContext[port][@scope]
    prefix = []
    dataIp = null
    # Read IPs until we hit data
