Change the profiler loop to use try_recv to avoid recv on closed port

Will exit during shutdown instead of crashing trying to recv on a closed port.