tdf#148146 Selecting an Impress template results in failed assert

regression from
    commit 31e7845339b30a69f06a04619660398fe4267268
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Thu Feb 17 12:19:49 2022 +0200
    use more SfxItemSet::CloneAsValue

Change-Id: Ie56fe208b64d464bf24c480db69c03cbe438a032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131979
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 89d8266..94fcdf9 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -388,11 +388,11 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &
    css::uno::Reference< css::frame::XModel >  xModel = xDoc->GetModel();
    if ( xModel.is() )
    {
        SfxItemSet aNew = xDoc->GetMedium()->GetItemSet()->CloneAsValue();
        aNew.ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
        aNew.ClearItem( SID_FILTER_NAME );
        std::unique_ptr<SfxItemSet> pNew = xDoc->GetMedium()->GetItemSet()->Clone();
        pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
        pNew->ClearItem( SID_FILTER_NAME );
        css::uno::Sequence< css::beans::PropertyValue > aArgs;
        TransformItems( SID_OPENDOC, aNew, aArgs );
        TransformItems( SID_OPENDOC, *pNew, aArgs );
        sal_Int32 nLength = aArgs.getLength();
        aArgs.realloc( nLength + 1 );
        auto pArgs = aArgs.getArray();