Decided to avoid passing is_background all around and made it more explicit
for the render API to switch between whether stuff could be freed after the
device update or not. This seems to be better approach that forcing memory
free in cases which are safe for blender.
Still not sure why cases when scene BVH works correct after switching render
layers, this is to be investigated before commit.