Fix another null buffer problem when closing ledger buffers