Bug fix.

If connection is closed at the client end, doReceive() go-routine should
exit. Also, Close() api resets autoRestart flag before doing close() on the
connection.