Fix compiler warnings

Most of the changes are related to extraneous semicolons at the end of namespace blocks (which certain gcc versions will complain about when --pedantic-errors is used).

Fixes issue #513