The ignore_unavailable option should also ignore indices that are closed

PR for #6471
This code block is an optimization that's useful in case there's no aliases in the input argument and we can return that same array quickly as we received it. I wonder if it still makes sense to have this optimization given that we might need to modify the array. I would love to remove it as it adds complexity... What do you think @martijnvg?