Are the flies in the compost heap the same kind as the ones that chase you around?
Here, also in Scotland, this year we have black medium sized flies which circle your head, try to settle in your eyes, and generally drive you to distraction. They tend to be associated with tall growth - trees and such, and annoy livestock too. Apparently the way to deal with them at the time is to use two hands and clap the flies to squash them. They don't move very fast. I'm stuck with the run around screaming option, flapping my hands and getting in a really bad temper

A compost heap I would have thought would have had fruit flies and other very small flies in large numbers, but they don't usually chase you around (not fruity enough

) To deal with those, turn over the heap as you have done, restack it, cover with a tarp or similar, and let it rot down completely. Fully rotted compost is lovely stuff and doesn't attract flies, rats or anything annoying. Not being your heap, you won't know just what has been put in it. Citrus peel doesn't rot well on a heap, so would continue to attract fruit flies. Too much cut grass turns to a foul sludge which certainly attracts flies.
Another option would be to prepare the trench for your next year's runner beans, by digging it deep, filling with all the stuff from the compost heap, then filling it back in. By the time you plant the beans, the stuff will have rotted down to a state useable by the plants.
Then of course there is the Scottish midgie -
give blood; visit Scotland - they cause many Scots to spend the evenings locked behind closed doors. The kind of insect repellent you apply to the skin will help, as will a really smokey bonfire, and a strong wind.
Then there are mozzies, which do lurk in clouds.
It has been the worst year we've had here for the larger devils which feast on your eyes, but the midgie and mozzie season is only just getting into the swing of things.
I bought a beautiful midgie head net with attached hat, but felt sea sick the instant I put it on - probably just me. I also bought a plain midgie net, but can't use that either

It is really worth while getting at least an ordinary net; they cost just a pound or two and would give you time to sort out the basic problem. Get the kind which specifies being for midgies, because the mozzie ones will let midgies through.