(chainbase) don’t keep file mapping active when in heap/locked mode
(chainbase) don’t keep file mapping active when in heap/locked mode

When in heap or locked mapping mode, pinnable_mapped_file initially maps the database so that it can copy its contents in to the heap/locked memory. Then on shutdown it copies the heap/locked memory back to that mapped file.

This means that during execution in heap/locked mode the process actually shows double memory usage as expected: once for the mapped file that is kept around, and once for the heap/locked memory.

This change closes the mapping after its contents have been copied to the heap/locked memory. It then reopens the mapping on shutdown so that the contents can be copied back. So now during execution the database is only consuming the expected memory

EOSIO/eos,EOSIO/eos,EOSIO/eos,EOSIO/eos,EOSIO/eos