Fix writefh on JVM to not emit trailing nullbytes.