Fix a rather stupid error due to a typo preventing writing support from working properly.

- Fixed write support because we tried to open the file mode instead of the actual file path
- Try to clean up some memory leaks that have been happening, there's still some around but a lot of them have been cleaned up a bit
- Resend packet time setting has been moved into QueuePacket() where it really should be
- Check that we have write access to many files and directories we're serving before we serve them and quit (or warn) if we can't do anything.
- Fixed an error sending acknowledgement packets because they were stack allocated
- Deallocate clients immediately after sending an Error packet so we don't resend it infinite times.