Fix the listeners closing process