use end instead of close
Merge pull request #35 from dominictarr/master

use end instead of close