Found the issue, I was calling:
assemble(JcrPackageDefinition definition, ProgressTrackerListener listener, java.io.OutputStream out)
But that writes the file to the output stream requiring therefore an additional build step. The solution was to invoke:
assemble(JcrPackage pack, ProgressTrackerListener listener)
Thanks all for your time.