I find your trick helps to prevent it, kind of go idle for a few before closing, but not always, and have noticed though it 90% of the time throws that line, on purging, like it gets hung in that step.
I think it still happens for most of us, but we just learned to end task and move on with life.