MODE-2310 Added some error handling for the case when the repository has already been shut down