Fix multiple namespaces within the same file

Fixed issue when having multiple namespace within the same file.

E.g. 

namespace Foo;
class Bar {}

namespace Toto;
class Titi()

or 

namespace Foo {
     class Bar()
}

namespace Toto {
      class Titi()
}