The owner library could keep invalid references to removed archive libraries after undo. This should fix the immediate issues reported as #147236, #147095 and #147036. There is still a known crash, although it is harder to reproduce reliably from the UI, so it will be handled separately. It is tracked by #147317.