Close TCP connections and updated mispelled errors

This addresses #1 in addition to some misspelling issues.  It fixed using @helinwang code.