anchor.diff:              recv_next_chunk(YawsPid, Arg);
           {error, Reason} ->
               ?Debug("TCP error: ~p~n", [Reason]),
  +            yaws_api:stream_chunk_end(YawsPid),
               case Reason of
  -                closed -> close(RPState);
  -                _      -> ok
  -            end,
  -            outXXX(500, Arg)
  +                closed -> ok;
  +                _      -> close(RPState)
  +            end
       end.
   
   %%==========================================================================
  
positive.code:         {error, Reason} ->
              ?Debug("TCP error: ~p~n", [Reason]),
              case Reason of
                  closed -> close(RPState);
                  _      -> ok
              end,
              outXXX(500, Arg)
      end;
  
negative.code:                 {error, Reason} ->
                      ?Debug("TCP error: ~p~n", [Reason]),
                      case Reason of
                          closed -> ok;
                          _      -> close(RPState)
                      end,
                      outXXX(500, Arg)
              end;
  