Added writing backgrounds, fixed bug

Fixed resources that were removed from being included in the file
(screws up resource tree and resource indexes).