Fix a segfault when removing a timer while iterating over them.