Are you running a third party launcher, like Nova? I had that problem (the tablet would stay in landscape after I exited an app running in landscape) under Lollipop, but after experimenting I think it was due to Nova Launcher doing funky things. I fiddled with settings (turned off auto rotation in Nova) and the problem disappeared. I have not had a similar problem with Marshmallow.