added proper method for closing connection to database after use.