Close response after writing JSON.