Do profile freeing under lock - avoid double free issues