CPython: fixes for txn freelist

* If environment is invalidated then trans_clear() would be called,
  which would correctly obliterate all resources if valid==1, except
  that caused trans_dealloc() to crash since unconditional self->env
  dereference.

* If .commit() or .abort() were called on read-only txn, valid is unset
  but the MDB_txn would not yet be freed. Update trans_clear() to also
  invalidate everything if TRANS_SPARE is set.
Update env_test to cope with cached readers

Need to open completely independent environment and close it in order to
ensure cached readers are closed.