Override method for catching the listening thread shutdown