fix empty sheet crash error
End write stream if error occurs
delete hidden property from template row