adding close signal handler