Added memory cleanup to IPC client (fixes #21).