[FIX] XQuery: do not address DBNode after database has been closed
[MIN] cleanup
[ADD] Storage: write document paths to disk. #804