removeAllListeners: check if listeners exist for a given type before trying to remove them