Cyclization of unsaturated hydroxylamine derivatives