anchor.diff:  
   -spec send(nnsocket(), iodata()) -> ok | {error, any()}.
   send(Sock, Data) when is_port(Sock) ->
  -    true = port_command(Sock, Data),
  -    ok.
  +    try
  +        true = port_command(Sock, Data),
  +        ok
  +    catch
  +        error:badarg ->
  +            {error, closed}
  +    end.
   
   -spec recv(nnsocket()) -> {ok, nndata()} | {error, any()}.
   -spec recv(nnsocket(), timeout()) -> {ok, nndata()} | {error, any()}.
  
positive.code:         {connected, Owner} when Owner /= self() ->
              {error, not_owner};
          undefined ->
              {error, einval};
          _ ->
              {ok, Opts} = getopts(Sock, [active,type]),
              {active,A} = lists:keyfind(active,1,Opts),
  
negative.code: recv(Sock, Timeout) when is_port(Sock) ->
      Ref = make_ref(),
      Bin = term_to_binary(Ref),
      try binary_to_term(port_control(Sock, ?ENM_RECV, Bin)) of
          {Ref, wait} ->
              receive
                  {Ref, Reply} when is_tuple(Reply) ->
  