CRM-15764 - Make opendir() usage more consistent.

When the result of opendir() is unchecked, it's unwise to start a loop based on readdir() from the directory handle.

This commit should ensure that opendir() result is always checked. Removes `@` error control operator in a couple of locations.