Replace readMVar with takeMVar; make hClose explicit; don't call cursor finalizer twice

fixes #7