MB-12451 mcd leak when socket closes during read

Move the code which requires engine release to be
before the place we tear down the engine reference.

Change-Id: Ib4da63b25a2f1098969bd8bab804012ba1ef325a
Reviewed-on: http://review.couchbase.org/42472
Reviewed-by: Jim Walker <jim@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>