PEI stands for Poly(ethyleneimine). There would be variety of PEI solutions (e.g., PEI1800), each of which have different numbers of free primary amine groups. Therefore, make sure the solution you are using have the correct amount of $\ce{NH2}$ groups available for the reaction. In Ref.1 (the reference you have given as example), the authors have capped different number of $\ce{NH2}$ groups in PEI1800 using different amounts of capping agents (reaction with at different molar ratios) as needed (capping agent examples: Imidazolyl and guanidyl). Although the procedures are different for each and different capping reagent, the authors have let each capping reaction stirring at $\pu{75 ^\circ C}$ for $\pu{8 h}$ with nitrogen.
The important fact you have forgot to mention when using PEI is that you may need to lyophilize the material in order to remove all water in the solution before subjected to undergo further reactions like capping $\ce{NH2}$ groups. According to the Ref.1, PEI1800 was lyophilized before use and the product was also lyophilized after, before they use them in the intended research. Also, in the text of the Ref.1 says that free $\ce{NH2}$ groups in PEI1800 is 16 (not 12 as you mentioned). Thus, if you want to cap all of free $\ce{NH2}$ groups, you may need to uses excess capping reagents.
As Waylander suggested and the authors of the Ref.1 have done, keeping the reaction under nitrogen would be better. However, a 5-day reaction time is too long and asking for trouble. Thus, I'd like to suggest to use a catalyst to shorten the reaction time. The one good, cheaper catalyst would be cyanide ions $(\ce{NaCN})$, which would dissolve in methanol (Ref.2). If you like to use an organic catalyst instead, 1,5,7-triazabicyclo[4.4.0]dec-5-ene (TBD) would be a good addition (Ref.3) in aminolysis of ester. Regardless of what you have used, your protective group would be safe as long as you have avoided acidic conditions.
References:
- Jie Song, Dongli Wang, Jing Wang, Qing Shen, Cao Xie, Weiyue Lu, Ruifeng Wang, and Min Liu, "Low molecular weight polyethyleneimine modified by 2-aminoimidazole achieving excellent gene transfection efficiency," European Polymer Journal 2020, 140, 110017 (11 pages) (DOI: https://doi.org/10.1016/j.eurpolymj.2020.110017).
- Thomas Hoegberg, Peter Stroem, Michael Ebner, and Sten Raemsby, "Cyanide as an efficient and mild catalyst in the aminolysis of esters," J. Org. Chem. 1987, 52(10), 2033–2036 (DOI: https://doi.org/10.1021/jo00386a025).
- Cyrille Sabot, Kanduluru Ananda Kumar, Stéphane Meunier, and Charles Mioskowski, "A convenient aminolysis of esters catalyzed by 1,5,7-triazabicyclo[4.4.0]dec-5-ene (TBD) under solvent-free conditions," Tetrahedron Letters 2007, 48(22), 3863-3866 (DOI: https://doi.org/10.1016/j.tetlet.2007.03.146).