Backends: avoid null dereference in metal and osx shutdown (#6385, #6334)

Co-authored-by: Alexander Rath <alex@ist.besonders.cool>
2 files changed