Use autodie for {open,close}dir and replace bareword handles

Ensure errors from opendir/closedir is always trapped.  For files,
where critic found a violation (only found closedir-cases) convert
them to autodie.  At the same time, convert bareword dir handles into
lexical ones.

Signed-off-by: Niels Thykier <niels@thykier.net>