Free memory for each page query when done with it.

I don't claim a deep understanding of the script, but this addition fixed a "mysql client ran out of memory" error for me while running on a large wp_posts table.