reject log registrations for finished recipes/tasks

Also fixes a bug with the error handling in LogFile.__enter__ which
I noticed while testing this patch.

Bug: 962253
Change-Id: Ib216cbf69228f8af3ce29293d42f713eddd29650
Merge "reject log registrations for finished recipes/tasks" into develop