close process before exiting