consider to use persistent connections.. this way you do not have to close them, your web-server wont need to open and close it thousands of times and everything will be faster... serious...
php.net/mysql_pconnect
take a look at this function description.