MB-29554: Handle case when MemoryUsed is invoked after index is closed
MB-29554: Handle case when MemoryUsed is invoked after index is closed

T1:
runtime.sigpanic()
	/home/couchbase/.cbdepscache/exploded/x86_64/go-1.9.6/go/src/runtime/signal_unix.go:367 +0x17c fp=0xc4315bc928 sp=0xc4315bc8d8 pc=0x44432c
github.com/blevesearch/bleve/index/scorch.(*IndexSnapshot).AddRef(0x0)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/godeps/src/github.com/blevesearch/bleve/index/scorch/snapshot_index.go:77 +0x22 fp=0xc4315bc948 sp=0xc4315bc928 pc=0x6012c2
github.com/blevesearch/bleve/index/scorch.(*Scorch).currentSnapshot(0xc420364380, 0xc4314ca180)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/godeps/src/github.com/blevesearch/bleve/index/scorch/scorch.go:427 +0x53 fp=0xc4315bc970 sp=0xc4315bc948 pc=0x5ffc03
github.com/blevesearch/bleve/index/scorch.(*Scorch).MemoryUsed(0xc420364380, 0x0)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/godeps/src/github.com/blevesearch/bleve/index/scorch/scorch.go:512 +0x38 fp=0xc4315bc9a0 sp=0xc4315bc970 pc=0x600dd8
main.scorchSize(0xdbf6c0, 0xc420364380, 0x6812d7)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/cbft/cmd/cbft/app_herder.go:296 +0x3c fp=0xc4315bc9c8 sp=0xc4315bc9a0 pc=0xbc97cc
main.(*appHerder).indexingMemoryLOCKED(0xc42023a690, 0xc42023a6b4)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/cbft/cmd/cbft/app_herder.go:122 +0x9f fp=0xc4315bca60 sp=0xc4315bc9c8 pc=0xbc87bf

T2:
sync.runtime_SemacquireMutex(0xc42023a6b4, 0x0)
	/home/couchbase/.cbdepscache/exploded/x86_64/go-1.9.6/go/src/runtime/sema.go:71 +0x3d fp=0xc420339600 sp=0xc4203395d8 pc=0x44062d
sync.(*Mutex).Lock(0xc42023a6b0)
	/home/couchbase/.cbdepscache/exploded/x86_64/go-1.9.6/go/src/sync/mutex.go:134 +0xee fp=0xc420339638 sp=0xc420339600 pc=0x466f7e
main.(*appHerder).onClose(0xc42023a690, 0xdbf6c0, 0xc420364380)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/cbft/cmd/cbft/app_herder.go:83 +0x3a fp=0xc420339698 sp=0xc420339638 pc=0xbc844a
main.(*appHerder).onScorchEvent(0xc42023a690, 0x2, 0xc420364380, 0xd06f1a6)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/cbft/cmd/cbft/app_herder.go:302 +0xc2 fp=0xc4203396c8 sp=0xc420339698 pc=0xbc98d2
main.(*appHerder).ScorchHerderOnEvent.func1(0x2, 0xc420364380, 0xd06f1a6)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/goproj/src/github.com/couchbase/cbft/cmd/cbft/app_herder.go:292 +0x48 fp=0xc4203396f8 sp=0xc4203396c8 pc=0xbd9a98
github.com/blevesearch/bleve/index/scorch.(*Scorch).fireEvent(0xc420364380, 0x2, 0xd06f1a6)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/godeps/src/github.com/blevesearch/bleve/index/scorch/scorch.go:122 +0x55 fp=0xc420339720 sp=0xc4203396f8 pc=0x5fd9b5
github.com/blevesearch/bleve/index/scorch.(*Scorch).Close.func1(0xc420364380, 0xbeb41277d6e9dc06, 0x29ace50f52, 0x144bc40)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/godeps/src/github.com/blevesearch/bleve/index/scorch/scorch.go:224 +0x63 fp=0xc420339750 sp=0xc420339720 pc=0x60b253
github.com/blevesearch/bleve/index/scorch.(*Scorch).Close(0xc420364380, 0x0, 0x0)
	/home/couchbase/jenkins/workspace/couchbase-server-unix/godeps/src/github.com/blevesearch/bleve/index/scorch/scorch.go:244 +0xde fp=0xc4203397a0 sp=0xc420339750 pc=0x5fe3ae

blevesearch/bleve,blevesearch/bleve,steveyen/bleve,steveyen/bleve