Issue #2939491 by hchonov, slasher13, alexpott, dawehner: Prevent memory leak and inconsistent entity references when serializing entity storages