TRQ-2289 - Queues disappeared

- Make sure to check the return code of close() calls
- Change to rename() instead of unlink(), link(), and unlink()
Merge pull request #193 from mattaezell/trq2289

TRQ-2289 - Queues disappeared