Only call CloseWrite if it is implemented

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>