Revert "exitonclose to dispose"

This reverts commit 5437997515446a6060a95ff4462cc6baa8b4323b.