Fix randomly closing opened actions when autosaving
lock() call requests all the strokes to finish, which is not
what we want during autosave. Therefore, we just forbid autosave
while some action is running.
This patch will also fix some bugs with random hickups when doing
strokes (when autosave does something in the background).