image: Fixed mount directory reset logic in cleanup function