The cap needs to be tight so the gear oil is forced through the little shaft holes,lubricating the cogs.
Gasket sealant might not make a permanent seal due to oil pressure and heat generated by the engine expanding and contracting it,plus it could be forced out.
You may have to get the end welded up to make it oil tight.
On my clutch basket bearing,I put a 2p coin over the end of the shaft to protect the little cap from being disturbed whilst removing the bearing.
I recently had to buy a second hand full gearbox due to the original front sprocket shaft bearing collapsing and breaking up after 2300 miles of use after the engine had been stood for 15 years in my garage.
It dumped the oil over the rear tyre and locked the back wheel nearly throwing me off the bike.
After getting the bike home and taking out the engine and stripping it,the inside of the sprocket bearing outer race had rust patches and pitting.The opposite end push-on smaller bearing had seized and turned blue along with the end of the shaft.
The left hand side gear cogs teeth on both shafts were mangled along with the kickstart idler gear.
I bought 5 genuine yamaha gear shaft bearings for both shafts for the second hand gearbox and pulled the 2 large bearings off the sprocket and clutch basket shafts using bearing pullers.