Use index.submit instead of attach.write

This makes multiple lines in stdin to be treated as different events