A teenager's prank using the file-sharing feature and a toy gun caused a three-hour delay for hundreds of passengers.