Added a method to the CorpusAdapter which closes the adapter safely.