Fix [ bug #1154 ] Error when closing a service in a contract (pgsql)