Improve windows stop functionality