Adding signal handler to remove shared mem and semaphore