Now the build is stopped when closing the app

Implement a new way of killing the building process that works on al
cases.
Add listener for the closing window event and stop the build in it.

Closes #4