Delete listener when its events map is empty.

Previously a listener only gets deleted based on parameters passed to
stopListening, whereas it should get deleted if it doesn't have any events in
its _events map.

Fixes #2619