Added an eventloop to the nx_window_unix. Also made sure that the close
event is handled properly.