Fix #endif in wrong place