Some tcp-socket cleaning up

Summary: 
* Better handling of closing
* Improved names of some internal functions
* Simplified read-loop and promise usage
* Give correct errors when they happen
* Correctly stop the accept loop when closed
* Code 'NONE' used for when there is not an error (instead of always saying there is an error)
* No printing of pointless warnings for each internal socket number
* Use early return style rather than else-statements

Fixes: https://github.com/freedomjs/freedom-for-chrome/issues/12

Tested: used with socks-rtc and tested using telnet to the localhost echo-server running in the chrome app.