[backport 3.0.x] Only consider opened projects when computing a project's direct dependen...

...cies

When computing a project's direct dependencies, filter out non opened
projects (if a project is open it implies it exists, which is why there is no
need to check for `project.exists`).

Fix #1001714
(cherry picked from commit 784667c7b855cd603937b9a92a82c36c05341672)