“iTunes media folder location” keeps reverting to local storage instead of persisting the NAS location, how to stop this?

I have my iTunes music held on a NAS box and apart from severe lag times, it works fine, however, occasionally iTunes just switches the ‘media folder location’ back to the local machine without even asking me.

The wifi connections between iMac/NAS/Router are fine and are always available.

How can I prevent it from automatically switching it back?