This pull request bundles a few commits with changes that I wrote to discover and fix @Diapolo's problem with LevelDB I/O errors after the maximum number of open files was reduced to 64.
The first one improves an error message, the second makes sure closing files succeeds, and the third fixes the actual issues (table files being opened by different threads simultaneously).