I am not a medical doctor, nor do I make any claims to be. I have simply found a few things that work in a specific case and am sharing them in hopes that others in similar situations might benefit.
I really hate to walk away when I'm on a roll, my mind is really in the moment and has a list of to-dos that is 100 items long. If they are floating around in my head, it does interfere with sleep. I keep graph-paper notebooks with sewn bindings, which have a bit of permanence, and pick up a pen and get them out of my mind so I can close the day.
I think what would help others in similar situations would be advice how to get out of those situations.