tried to fix segfaults around _CLOSE_