Added signal handlers to avoid core dumping when program is abruptly
terminated due to memory errors (SIGABRT or SIGSEGV).