Allow write filters to be asynchronous.

If code is not declared async, then it is still run synchronously to allow
maximum backward compatibility.