hooks/post-install/create-xbps-metadata-scripts: make sure to finalize scripts correctly.

The issue was that if a pkg does not add the missing newline at INSTALL
or REMOVE scripts, those were generated with a syntax error.

Found by onekk.