jpg files truncated by un-incremented pointer

the updated pointer to the end of the file returned from close_stream was not used so the returned jpg was truncated