Experimenting with weird ideas I changed the full_node code to close the chain first then the p2p connections, this seems to at least reduce the probability of it hanging. My guess is, without my changes, that one of the p2p connections is waiting for the chain to do something, the chain is 'stopped' and not doing much and as a result everything just hangs