<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assert_compile_finished(app_folder):
 """ Once builder.sh has invoked the compile script, it should return and we should set a flag to the script returned. If that flag is missing, then it is an indication that the container crashed, and we generate an error. This function will clean up the flag after the check is performed, so only call this function once. See issue #141. """

    fpath = os.path.join(app_folder, '.postbuild.flag')
    if not os.path.isfile(fpath):
        msg = ('No postbuild flag set, LXC container may have crashed while '
               'building. Check compile logs for build.')
        raise AssertionError(msg)
    try:
        os.remove(fpath)
    except OSError:
        # It doesn't matter if it fails.
        pass