Properly cleanup on exit