Closing the database with the close like you have it isn't needed unless it's a persistent connection. A regular database connection is automatically closed at the end of execution of the script.
$db->close() is called in most vb scripts - it's in function exec_shut_down() which is called from print_output(), which is the last function called in most scripts. (You can see it in the eval() at the end of showthread.php).