Implemented closeConnection() properly.