Finish buffer before encoding return