Manual cleanup to prevent static destructor race