fix exit codes for writes