Call close as a function rather than a method

Hopefully fixes test failure on 5.10.0 on MSWin32