Add device creation to device/platform wrappers and test

Some memory leaks/errors to fix