I get this problem a lot. It seems to occur whenever I have had some clips temporarily positioned beyond the end of then project and have subsequently deleted them. After deleting, the project end should re-adjust. Sometimes it does but usually it doesn't.
I have several projects that end a few bars further on past the desired end point. But I have double checked every track and bus for automation or anything else beyond the project end and found nothing. Either there is still something invisible still remaining or otherwise maybe there is possibly a bug in Sonar preventing re-adjustment of the project end. I suspect the latter.