Refactor the unit test for MemoryBuffer::getOpenFileSlice

Run in two different modes: with and without reopening the temporary file
between creating it and mapping it with MemoryBuffer.