This exact error is an issue which is about to be fixed in 7.3.1 next week (the PR already merged). The problem is that the transaction which was started for the query expired before the query finished. If you look into stardog.log you'll probably see something about closing a tx due to inactivity. It only happens at higher values for query.timeout. You need to set the database.connection.timeout property to something greater than 3600s.
Stardog 7.3.1 won't let transactions expire while a query is making progress.