fix shutdown method to check for repoConnection null