Handle kill signals gracefully