improved error msgs and refactored close in the net module
realised extra parameter was unnecessary
ensure file descriptor is closed
Merge pull request #1746 from cowboy-coders/socket_close_clean

Fix close procedure in the net module