Fix last event being written twice