This avoids throwing in some edge cases. For example, when a corestore is closed before a hyperswarm, the ondiscoveryKey callback can still trigger, causing an error like
Error: The corestore is closed
at Corestore.get (.../node_modules/corestore/index.js:376:51)
at ondiscoverykey (.../node_modules/corestore/index.js:436:27)
...
at ReadableState.update (.../node_modules/streamx/index.js:344:12
...
Closing a corestore before the swarm might also just be undefined behaviour though, in which case: feel free to close
This avoids throwing in some edge cases. For example, when a corestore is closed before a hyperswarm, the ondiscoveryKey callback can still trigger, causing an error like