Run layoutIfNeeded before renderInContext

Things like auto layout seem to work best if you call layoutIfNeeded before renderInContext.