Moving operations into the "with self._connect" means less opening and
closing of the database. Returning early if there is no data to write
avoids writing empty contexts.
* Expose switch_context in public API
* Test switch_context
* Helper method to get full paths to measured files
* Get correct file paths on all OS
* Note version that introduced this method