Timer script Not Cancelling if state changes

I suspect that the example code where ever it is you learned to use this.timer has examples of logging. This also has some examples.

You can not be successful writing openHAB rules if you don’t use logging.

There are dozens of other examples. You will be hard pressed to find any JavaScript rule posted to this forum that doesn’t show logging.