Return error code if unlinked files are found
While looking at CI/CD output of this script: https://gitlab.com/gitlab-org/gitlab-docs/-/jobs/1965172468, I noticed it returned success code even if problems were found.
This update makes sure it returns an error code so it is better reflected in the CI/CD status. While here, also tried to improve code quality.
Edited by Evan Read