Adjust scheduler isCancelled, see #2903

* isCancelled shall return false if the task is expired (run)
  before cancel() is performed
(cherry picked from commit 0c93ca317ef9085c3928e761843aa6d60912741c)