[fix] exit process properly on err