Add pub/sub to events to the map
Notify to the listeners that the application is going to exit