Clear the remaining queries from connection(queue) before release the connection.
Modify way to clear an array of queue. (Thx. tellnes)