You've got some queries building up from somewhere.
SELECT COUNT(*) as total, a.USER_ID, b.USER_DISPLAY_NAME as user
FROM ubbt_POSTS AS a,
ubbt_USERS....
I can only see part of the query. That's not a standard .threads query, so something is trying to query against the posts table even though it's closed.