To close period "%(period)s" you must link all payable/receivable lines to invoices.