make shutdown work properly
Make sure process exit cleanly