Fixed memory corruption that occured when writing rdpFile to disk