In my experience there is always something causing the project to play beyond what you think is "the end"
This list isn't exhaustive, but pretty close:
Tempo changes
Meter/key changes
Automation nodes
Thin "slivers" of data - could be audio or midi, though these will show up in the event list
Controller data
You need to check all of the above, not just for the visible tracks, check it on hidden tracks, archived tracks, ditto for busses.
Hit ctrl + end to find out where Sonar reckons the project ends