Changed LevelDB cursors to use scoped pointers to ensure destruction when going out of scope.

This corrects a bug where an exception thrown reading from the database causes the cursor to
be left open, which causes an assertion error to occur when the database is deleted (around
line 938 of init.cpp).