fix typos and log exceptions in __exit__

* log when exception detected in __exit__ for context managers (otherwise it will never be logged)
* fix typos from stderr vs std_err for command results