Fixed various memory leaks and mutex issues. Optimized various functions.

Previously, after being open for some length of time the photo booth would completely crash the OS, requiring a hard reboot.

This issue appears to have been caused by not taking thread-local references of GAsyncQueues. This issue appears to be resolved.