Added graceful exit (signal handling) to scripts