The exception handling is not perfect, so when an
Exception is thrown establishing a connection in
KFM_Database, the code using this method catches the
exception and tries to close the database connection in
a finally block. This obviously always fails as no
connection could be established. The exception thrown
doing this covers the original exception that was
submitted by the connection not being available.
Fix several code places by checking isConnected()
before freeConnection().