added ability to close and reopen chat windows & other minor changes

Hash tables would have been the ideal data structure but this should be fine.