fix memleak in levelviewer, use helper for file loading