Add check to GetFrame function to handle a frame number greater than total number of frames

This will allow handling a case where a GetFrame request may be for a frame number greater than the total number of frames. It will simply set n to the last frame and return that.