Fix some semantic usability issues with DynamicLibrary.

This patch allows invalid DynamicLibrary instances to be
constructed, and fixes the const-correctness of the isValid()
method.

No functional change.