Frames and systems are not my friend.

Oh, and the reason you had about a dozen empty pages at the end of the music was due to the very final page having an override: go to Engrave mode, scroll to the bottom of the Pages panel on the right-hand side, select the last page with the red triangle showing its override, right-click and choose Remove Page Override.