Fix switching logic to switch to existing but unloaded files