Fix non slim mode for threading
Make node-persistent-cache (alias flat-nodes) thread safe.

Make the reading thread safe by moving everything into a per thread context
and have separate caches and file pointers open per thread.

All writing to the flat-nodes file still has to be done during single threaded operation.