Added handling of SIGTERM signal