Is there a way to programatically close a block based on an IF condition (say if there is no data in it)