Prevent lock when deleting folder
Minor optimizations