When PHP exits, it gracefully closes the database connections.
The only reason to use the close method is when you want to end the connection to a database that will no longer be used, and you have a lot to do: how to process and stream data, but if it's fast, you can forget about the closed application.
Putting it at the end of a script means redundancy, lack of performance, or increased memory.
What is important: delete unused data, and if you want to avoid memory leaks (which in my humble treatment are a PHP core problem in this case), use:
mysqli_kill(); mysqli_close();
Thus, the socket is also killed.
source share