The problem was that the file handle was not closed in the Portfile. Adding close ${f} fixes it. Thanks @l2dy for the fix. I just opened a PR [1]. Greg [1]: https://github.com/macports/macports-ports/pull/11027