A model for the onset of oscillations near the stopping angle in an inclined granular flow