added SIGTERM handler for clean shutdown on kill