I'm not quite sure what you mean by match on the return value. Do you mean this?

case close(Socket) of
    ok -> ok;
    {error, Reason} -> error_logger:error_msg("error closing ssl socket: ~p", [Reason])
end