Closing/destroying files after reading/writing?

it should be no problem to write a function which returns a product. For instance in this example a function is written which returns a band. Not a big difference compared to a Product from a API point of view.

You can call product.dispose(). This will release all for this product allocated resource. The product will not be usable aftwards.
To release memory explicitly you can call the Java Garbage Collection.

System = jpy.get_type('java.lang.System')
System.gc()