Silence "print() on closed filehandle" warnings

Trivial nit: If `$PERLBREW_ROOT/perls/perl-*.*.*/.version` is read-only (e.g., a root-owned, system-wide directory like `/opt/perlbrew`), don't try to write to it.