function closeSession(session, status) {
  let context = {};
  if (status) {
    context = { status };
  } else if (session.status === 'ok') {
    context = { status: 'exited' };
  }

  updateSession(session, context);
}
Closes a session by setting its status and updating the session object with it.
Internally calls `updateSession` to update the passed session object.

Note that this function mutates the passed session (@see updateSession for explanation).

@param session the `Session` object to be closed
@param status the `SessionStatus` with which the session was closed. If you don't pass a status,
              this function will keep the previously set status, unless it was `'ok'` in which case
              it is changed to `'exited'`.