Fix Exception for project closure that contained closed project

When asking for the closure of a project where one of the of the
projects in the dependency chain was closed an exception would
be thrown.

This is now fixed and I added a test that failed before the
fix but works now

Fixes #1001810