Fixed bug with duplicate tags not being detected

modio_wSessionTags variable wasn't having the tags put into it. Fixed
this so the loop that checks if a tag has already been used in a session
works.

Also added some more higher-level debug prints.

Moved session closing to a separate function.