There were often situations where some piece of data got stuck at the end and it wasn't obvious how to delete it. At least for me, ripple editing fixed that issue once and for all. However I don't think that's what's happening there.
Cakewalk is not a program that restricts you to a specific song length. It doesn't know how long a song you plan to record. When you open a new project, I think it defaults to 1400 measures of so. However if you keep dragging the now time to the right, Cakewalk will happily add as many measures as you want.
Try this test and report back on the results. Open a project and select all (Ctrl+A). If the gray line in the time ruler ends before the thousands of measures, that's the expected behavior and it indicates that your project has no more data past where the gray line in the time ruler ends. If the gray line extends for thousands of measures, then there's an anomaly.
As to getting rid of everything past the end of the song, I don't see any
practical reason to do that. All you need to concern yourself with are the measures that contain project data. I guess it would show you definitely that "the song ends HERE," but you could also drop a marker at the end and call it "Song End" if you're not sure where the song ends.