MDL-36963 Improve mdeploy worker::remove_directory() method