fix for change in order of the logs. another if added while the node closing function is called