IMHO, this is the alleged behavior. When you cancel the request, if there was an open transaction, it remains open until you explicitly commit or return it OR until the connection is closed
There are no valuable errors in your template. If you control the manual execution thread (Cancel Executing Query), then you should take care of open transactions in the same way - manually.
Update:
The behavior is controlled by the SSMS parameter. Disconnect after execution of the request - this means that the request is disconnected after execution or cancels and rolls back open transactions: 
source share