finicky arcpy is... in theory,
del raster_elevation, raster_slope
and for good measure
del arcpy
should remove the reference from python, but there is no guarantee
sometimes what I do, is have two instances of the same script open in two different IDEs and I just kill the one that was running the script and carry on in the other one. A bit of overkill, but separate python instances tend to play nice if arcpy gets too hungry.
And by the way... if arcmap is open, the lock can remain, so I rarely have it open unless I have to see the result. And if I have seen it, I remove the result, save the project and hope all references are killed during the save.
Good luck