A Gröbner basis proof of the flat extension theorem for moment matrices