Changed types Context and Socket from interface into struct.

This makes the methods visible in godoc. Using interfaces here is
not useful.
Also added checks for opening on a closed Socket or Context.