MAGMA-237 Refactor  method to handle value sequences and make it more efficient.
Javadoc.
Added closing of a list of closeables.