Alright, so we're pushing the bounds of theoretical good taste here. It's
kind of in B-flat major, but mostly because of the last two chords. It's
sort of tonal, but only because it remains (mostly) triadic. Bach would likely have rejected it; cadencing in E minor from B-flat major is really not appropriate, nor is a B-natural against a B-flat no matter what the voice-leading is doing.
Here it is, nonetheless.