add test for opening and closing in quick succession