added inv_rec parameter to be considered when closing or not closing the Invest