Added signal handler for SIGINT and SIGTERM