install signal handlers for proper shutdown