Unset reference variable after looping by reference for administrator/modules/mod_[a-z] and hathor admin templates

- When looping by reference, reference variable is not unset at the end of the loop.
- and a bit CodeStyle

see: https://github.com/joomla/joomla-cms/issues/5482