fix bug(num_writes is never zero because it is unsigned value)

success and failure of apr_file_write should be judged by its return value