Prevent filehandle from leaking