adds more checks for ros shutdown for cleaner exit