MB-9343 correctly close stream before the takeover

... so the replicator is aware of it and doesn't try to reopen
it again

Change-Id: I86607aef098a61dbb4136f72258c63c73a3c498d
Reviewed-on: http://review.couchbase.org/34129
Tested-by: Artem Stemkovski <artem@couchbase.com>
Reviewed-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>