vm: Fix memory leak in switching tasks

Signed-off-by: Bart Kuivenhoven <bemkuivenhoven@gmail.com>