TRQ-2289 - Queues disappeared

- Make sure to check the return code of close() calls

Some file systems (particularly NFS) do not report errors until the close()

- Change to rename() instead of unlink(), link(), and unlink()

Renames should be atomic, but a server crash between the first unlink() and the link() will prevent the server from coming up correctly.