snap_cursor_to_selected with context is incorrect
You should override all operators that depends on context as follows :

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        ctx = bpy.context.copy()
        ctx['area'] = area
        ctx['region'] = area.regions[-1]
        bpy.ops.view3d.view_selected(ctx)
        bpy.ops.view3d.snap_cursor_to_selected(ctx)
        obj.select = False
        new_obj.select = True
        bpy.context.scene.objects.active = new_obj

        # take new copy of the context because it is outdated now
        ctx = bpy.context.copy()
        ctx['area'] = area
        ctx['region'] = area.regions[-1]            

        bpy.ops.view3d.snap_selected_to_cursor(ctx, use_offset=False)
        break