Accept different error codes from close()

This should fix issue #148

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>