Close LevelDB cursor in case of an error loading blocks

Close LevelDB cursor in case of an error loading blocks. Otherwise an assertion error occurs when the database is deleted (around line 938 of init.cpp).

I don't have a simple test-case for this for Bitcoin, apologies; the problem occurs in Dogecoin 1.8 due to block length changes introduced for AuxPoW support, and this is effectively merging that change upstream.