Clean up some socket stuff, add close
I implemented you ages ago, shut up