Fixes issues #27: SIGSEGV when creating iterator after DB was closed

It will now throw a DBException instead.