Merged proper fix for mkClose() segfaulting in from P. Thoyts