Fix append bug

Do the seeking _before_ setting the value of position to stream.position. Fixes #2423