fixed the bug: close connection when query page total