How is a "SUBSCRIBE" request can terminate a SIP dialog ?
You should find all your answers in rfc6665. You may take a look more precisely at Section 4.2.1.4. Refreshing of Subscriptions and Section 4.4.1. Dialog Creation and Termination
Quoting some text of the rfc:
Here is the way to request the end of the dialog from subscriber side:
Clients can cause a subscription to be terminated immediately by
sending a SUBSCRIBE request with an "Expires" header field set to
'0'.
And the final NOTIFY that really terminates the dialog:
A subscription is destroyed after a notifier sends a NOTIFY request
with a "Subscription-State" of "terminated", or in certain error
situations described elsewhere in this document.