added code to close server listener, when email is sent
updated settings and kill process code