Set the appropriate context before calling write plugins.

The fix for issue #75 introduced a regression: Write plugins no longer have access to the read plugin's thread context, i.e. the interval in which the read plugin is being called.

This is fixed twice: The interval is set at enqueue time (when the original context is still available) and the context is also saved and restores (thanks to @tokkee).