Die on a failed zephyr_zwrite; don't silently ignore it

Unused return value made more obvious by clang scan-build
Fix some undefined behavior in filter.c, caught by clang scan-build