gc'ing before tearing down library prevents double-free of Plan's