mac: Clean delegate before releasing window