Added SIGTERM handling for clean program termination