server: update code to avoid potentially long mutex lock when importing/exporting files in VMs