Stop detach command from hanging, fix #33

The detach command wasn't closing the server socket, so force the socket
to close and allow the calling script to end.