changing event loop exit function