fix infinite recursion bug on exit after SIGUSR1

Signed-off-by: Mattias Andrée <maandree@operamail.com>