added gradient: closing - opening; still memory leakeage