This is related to a change in a recent version of iOS.
You need to ensure that Background App Refresh is enabled in iOS' Settings, in the General section. This will allow you to switch apps without being immediately disconnected.
N.B. due to an Apple limitation, the connection will still be closed after a couple of minutes when the VNC Viewer app is in the background.