Restore functionality to close channel AFTER all connections have been closed

On last commit, I moved the channel close to the wrong location.  Restoring functionality.  Sorry for the inconvenience.