Handling all posible signals for killing the main process