Fixed destructor

Was making a reference to `lib` instead of `library`
Fixed iteration in `shutdown()`

While I changed the for loop conditions to reverse iterate, I
didn't actually change the iterator itself to a revers_iterator