Add MIT license header
Handle the case when creating the window failed