Added a 'is destroyed' check in shader's destroy method