joomla/joomla-platform — pull request #629 by elinw (2011-12-10 02:50:55+00:00)
Title: Going back to the original proposal 

When $connection exists (which it always does) but is empty this causes a fatal error when attempting to close the connection. Therefore closing should not be attempted when $connection is empty.