OK, interesting.
It's no big deal as PHP ignores those extra closing tags.
I had this behavior in v 5.x up to now 7. 7.1.
I'm not using an EOF feature of PHP here. I'm using a few lines of PHP code and it seems to working well (other than the repeating PHP closing tags).
Attached is a screen shot of the cache_builders/custom/portal_box_1.php file showing the multiple PHP end tags creeping in.