Limit goToFrame function to avoid jumping out of bounds