Added lots of try-catch blocks around filter updates

Some exceptions could be thrown that weren't caught, which could
lead to a crash.

Removed some redundant writing of the final image.