Small clean-ups and leak fixes in the OPENDIR mechanism.