Make window.close() close the window.

Fixes #671.