Are you using persistent connections? IF not, then you really shouldn't worry too much about closing your connections. From the manual
Using mysql_close()
isn't usually
necessary, as non-persistent open
links are automatically closed at the
end of the script's execution. See
also freeing resources.
Instead of too_much unclosed connections, couldn't it be (which is essentially the same ofcourse) that you have too many open connections? For instance, too many users on your site at once?
If you do have persistent connections, do not forget this:
mysql_close() will not close
persistent links created by
mysql_pconnect().
As said in the comment, it is highly unlikely that a mysql_connect()
resource is not freed at the end of the script. From another manual page
Freeing resources
Thanks to the reference-counting
system introduced with PHP 4's Zend
Engine, a resource with no more
references to it is detected
automatically, and it is freed by the
garbage collector. For this reason, it
is rarely necessary to free the memory
manually.
Note: Persistent database links are an
exception to this rule. They are not
destroyed by the garbage collector.
See the persistent connections section
for more information.
There could be a sidenote however, from the comments on the mysql_close
page
At least with PHP5.3.2 and Windows
connecting by tcp, you should always
use this mysql_close() function to
close and free up the tcp socket being
used by PHP. Garbage collection after
script execution does not close the
tcp socket on its own. The socket
would otherwise remain in 'wait' state
for approximately 30 seconds, and any
additional page loads/connection
attempts would only add to the total
number of open tcp connections. This
wait time does not appear to be
configurable via PHP settings.