Fixed deadlock.

When you call timer.cancel(), it attemps to acquire a mutex which may
result in a deadlock.  By simply setting the active flag instead, we
achiev the same affect without the deadlock.

@benh @florianleibert