Fix use-after-free which may happen during shutdown

If a module, e.g. keepnick, tries to remove a timer in
OnIRCDisconnected.

Thanks to KindOne for the report.