grass provider: don't close invalid layers (fixes #7180)