Wip/quiet close

This should fix #114. Adds tests as well. Another commit fixes a related incorrect use of gssize vs. gsize in test.