Check ob_get_level() at ob_end_* calls where ob wasn't explicitly started

This check gives the current output buffer level, zero if there is no active output buffer, so it should prevent quite a few system notices, that so far just have been silenced with the @ operator.