i got some issues with note 9. auto locks when watching YouTube or an app in use not everytime but randomly...i think it happens after tht june 1st update ...
may be your proximity sensor (on the top right next to the earpiece) is covered by something like your screen protector , cover , dust or sensor is damaged