Close repository after each operation