Added auto-closing

Hi! It's my first pull request, please be gentle with me... :-)