How to display an alternative text if the comments are closed for the node?
Assuming you're using the default field definitions installed by the standard profile, what you want is the status property of the comment field of the node, which is accessible in twig via node.comment.status.

{% if node.comment.status == 2 %}
   {# comments are open #}
{% elseif node.comment.status == 1 %}
   {# comments are closed &amp; visible #}
{% elseif node.comment.status == 0 %}
   {# comments are closed &amp; hidden #}
{% endif %}