Please see the attached file. I don’t find a way to delete the last empty bars.
The trouble is that the double barline at the very end of the flow is preventing Dorico from deleting any more of the music: since you put it there, Dorico won’t remove it on its own. So delete the double barline at the end of the flow, and then try Write > Trim Flow again.
Dear Soundplane, it might be a good idea to change the thread’s title, adding [Solved] at the beginning. Anyone having the same problem would want to read it !
This still doesn’t resolve the issue.
I can’t “delete” the double barline at the end, but I can popover-B it to a single barline.
After that, I’ve tried to select that (now last barline) and try to make it a final barline. But that doesn’t work either.
So, I add a few extra bars to the project. When I do this, a final barline just show up at the end of those bars!
Then I proceed to do “Write > Trim Flow” as you suggest.
But then I’m just back at square one: which is a double-bar instead of a final barline.
The OP has removed the link to the Dorico file, so I can only speculate.
I’ve had this happen before, on a few rare occasions. IIRC, the solution was to show signposts and delete the time signature signpost that was attached to the final bar.