How can I get ViewRanger to keep recording my track on my tablet even when the cover is closed?
I got track recording to work while the device is closed:

In the device Settings app, go to "Apps" and on the "..." menu select "Special Access" then "Optimize Battery Usage".  Use the drop-down to make "All Apps" visible and then switch OFF the slider next to ViewRanger.

Source for that is here; it's the manual for a different mapping app.  The page opens with


  More and more users have been reporting issues with losing GPS signal
  during track recording when their device goes stand by...


and includes instructions on how to rectify the situation for various vendors and Android versions (the manufacturers all seem to have different ways of exposing this to the users).