PHP cleans up any mess you make.
PHP will close all files and connections, and free al memory.
However, this does NOT mean you should just forget about closing connections and freeing memory.
Not cleaning up your own mess makes you a bad programmer. 🙂