Fixed a bug with the auto quit/shutdown.