Fix ClassLoader leak during incremental compilation
(cherry picked from commit 76171a64182a6a7ae3d9f81b31720c53d66d8b07)