Delete field and related data (field_delete_field, field_delete_instance)
As fields can be attachted to differents bundles

field_delete_instance deletes the field itself only when there no more bundles using it. maybe see field_info_field and this comment from field_delete_instance to clarify

So if in 

 if ($field = field_info_instance('node', $fieldname, 'page')) {
   field_delete_instance($field);
 }


Applies and delete the last instance then in 

  if ($field = field_info_field($fieldname)) {
    field_delete_field($field);
  }


Should be null and wont execute field_delete_field($field);