Reconnect automatically to resolver

If resolver disconnected then it will try to reconnect on each resolve request
Some fixes in stream/generator.

Closing of a stream notifies waiters now.
Also method 'closed' of a generator is true when the stream closed and there is no chunks or exception in queue. It's like 'eof' now.