lock the library as long as we have open handles