Clean up applied classes when being destroyed