Fix issue #7379: Crash when attribute table is closed after layer has been deleted