For `compile(mode=single)`, if the statement contains newlines, the last statement must end with a newline (so the interactive interpreter knows to wait for input).  Here, there is no interactive user and no more input is forthcoming.  If the user didn't supply the final newline, we make sure that one is present.  This also applies to the `end_statement`.