Changed window so that it closes itself